How to build a transaction without signatures in Rust SDK?

I want to build a transaction without signing it. This might be useful for:

  • estimating transaction fees;
  • simulating the transaction.

I don’t want to sign the transaction and send it to simulation, because, in that case, the http request might be intercepted and the signed transaction might be used by a fraud.

The easiest example of a transaction to build is transfer. Here is how transfer transaction is constructed in fuels-rs:

There is a line responsible for adding a signature:

self.add_witnessses(&mut tx_builder);

I’ve tried to duplicate this code for building the transaction and removed the line with add_witnessses. But it turns out that ScriptTransactionBuilder.build function expects all signatures to be present. I get the following error:

InvalidData("signature missing for coin with owner...")

Is there a way to construct a transaction without signatures?

PS: in fuels-ts it is possible

In the transfer implementation the signing is done inside sendTransaction method. But the construction of the transaction request without signing it is totally valid:
fuels-ts/packages/wallet/src/account.ts at 166a48bb45b35fa5295ddce20d1f6e256b133a67 · FuelLabs/fuels-ts · GitHub

This should be resolved here How to sign a transaction in Rust SDK? - #2 by calldelegation

1 Like