-
Does cardano-client-lib handle witness and assembly? Those are capabilities of the cardano-cli providing the ability to distribute the transaction to other parties and having them sign it and then return a file that you can then use in assemble. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi, It's possible. Please go through the below options using low-level and high-level apis. Let me know if there is any gap. Option 1: Using Low-level serialization api a> Using low level api, you can create a Transaction object from TransactionInput[] and TransactionOutput[]. You need to find the required utxos through UtxoService / UtxoSelectionStrategy impl. After building the transaction, you can sign the transaction sequentially or distribute and then assemble. b> Sign the transaction with account1 Check this example (Transfer fund from multi-sig script address, at least 2 witnesses): https://github.com/bloxbean/cardano-client-examples/blob/5978765bac528adca9e981e8f3fad0b892abd232/src/main/java/com/bloxbean/cardano/client/examples/TransferFromMultisigScriptAddress.java#L115 Or, b1> Account 1 sign the original transaction Option 2: Using High Level api with some tricks Check the same example but using PaymentTransaction api : - https://github.com/bloxbean/cardano-client-examples/blob/5978765bac528adca9e981e8f3fad0b892abd232/src/main/java/com/bloxbean/cardano/client/examples/MultiWitnessWithPaymentTransaction.java#L34 Using PaymentTransaction api, it's possible to achieve the same. But some workaround required, like creating a ReadOnlyAccount class to pass sender to PaymentTransaction. Because sender here is a script address.
Probably we can update PaymentTransaction API to support multisig transaction without above workarounds. |
Beta Was this translation helpful? Give feedback.
Hi,
It's possible. Please go through the below options using low-level and high-level apis. Let me know if there is any gap.
Option 1: Using Low-level serialization api
a> Using low level api, you can create a Transaction object from TransactionInput[] and TransactionOutput[]. You need to find the required utxos through UtxoService / UtxoSelectionStrategy impl.
After building the transaction, you can sign the transaction sequentially or distribute and then assemble.
b> Sign the transaction with account1
c> Sign the output from step-b with account2. This will add additional witness
d> Post transaction with output from step-c
Check this example (Transfer fund from multi-sig script address, …