apps/docs/src/guide/cookbook/sway-script-with-signature-validation.md
This guide explains how to work with a Script that rely on in-code signature validation. This is particularly useful when you need to verify that a transaction was authorized by a specific account.
Here's an example of a Sway script that validates signatures:
<<< @/../../docs/sway/script-signing/src/main.sw#multiple-signers-1{rust:line-numbers}
This script:
true or false based on the validation resultOn Fuel, transaction signing involves using a wallet's private key to create a hash based on the transaction ID (which is the same as the transaction hash). The transaction ID is generated by hashing the transaction bytes themselves.
Important considerations:
When working with Sway programs that have in-code signature validation, the estimation process becomes more complex because:
Here's how to properly implement a transaction with signature validation for this specific Sway script:
<<< @./snippets/signature-script.ts#signature-script{ts:line-numbers}