⚠️ Warning: This code example utilizes the Fireblocks RAW signing feature.Raw Signing is an insecure signing method and is not generally recommended.
Bad actors can trick someone into signing a valid transaction message and use it to steal funds.For this reason, Raw Signing is a premium feature that requires an additional purchase and is not available in production workspaces by default. If you're interested in this feature and want to see if your use case is eligible for it, please contact your Customer Success Manager.
Fireblocks Sandbox workspaces have Raw Signing enabled by default to allow for testing purposes.
Clone the repo:
git clone <repo_link>
cd xrp_set_dest_tag
Install:
npm install -g typescript
npm install
Create .env
file and set:
FIREBLOCKS_API_KEY
- your API KeyFIREBLOCKS_SECRET_KEY_PATH
- path to your API secret keyVAULT_ACCOUNT_ID
- the ID of the vault account to execute the RAW signing request from
Example:
FIREBLOCKS_API_KEY="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
FIREBLOCKS_SECRET_KEY_PATH="/path/to/secret_key/file.key"
VAULT_ACCOUNT_ID=1
Runnig the script:
ts-node setDestTag.ts
Sign the RAW signing operation in your Fireblocks Mobile app. Make sure that you have the following result printed out to the console:
resultCode: 'tesSUCCESS',
resultMessage: 'The transaction was applied. Only final in a validated ledger.'
.
.
.
https://xrpscan.com/tx/<tx_id>
Check the transaction's hash in the XRP block explorer and make sure that the transaction was executed successfully.
If you want to disable an already enabled 'Require Destination Tags' configuration on your account, please update the transaction
object in the setDestTag.ts
file as following:
const transaction: TransactionJSON = {
"TransactionType": "AccountSet",
"Account": account,
"Fee": "1000",
//"SetFlag": 1 // --> Enable dest tag required
"ClearFlag": 1 // --> Disable test tag required (remove SetFlag in this case)
}
While SetFlag: 1
enables 'Require Destination Tags' configuration on your account, ClearFlag: 1
disables it.
Since XRP transactions require lastLedgerSequence
as a part of the transaction's body, when using RAW signing it is limited for a quite short period of time (up to 2 mins), which means that the transcation should be signed immediately after the submission. Waiting for longer signing time will result in unsuccessful transaction's broadcasting.