Transaction Hex to JSON
Using CSL you can easily convert it back to JSON.
It can be useful to do when you need to troubleshoot or verify your transaction directly in code.
Here is a simple example using a transaction Hex from another part of these documents.
Using Deno with the latest version of CSL.
import { Transaction } from "npm:@emurgo/cardano-serialization-lib-nodejs";
const payload = Transaction.from_hex(
"84a4008282582038796cb4b5f524054352b4b206995b266aa57d24ee7edd5163ea8920c45c0a0801825820fc288476df0e1cad16127bfe7a652e329b52ec439f193b26c71d260dca2fd13600018282583900d863b90d9b47629c09d2996ec4154a3f8bdbd72d5ecc85ab461854f38fcbfb9e771a928d717bd9877bc6db9a3dfa728330031aa2877c13b4821a0011f436a1581c1af660e4c58514a2f0ea167deca340381e55bed4aea60bc09c211417a14d416e76696c54657374313230380182583900c4e78614e6baf953d154a7b0b17e76265a5fa88e9988342db0f1b17065d2510958ce434208e16546b95124961824cfc6d3bd518766259a041a17e9215b021a0003d86d031a0450d3aba0f5f6",
).to_json();
console.log(payload);
This code snippet will print:
{
"body": {
"inputs": [
{
"transaction_id": "38796cb4b5f524054352b4b206995b266aa57d24ee7edd5163ea8920c45c0a08",
"index": 1
},
{
"transaction_id": "fc288476df0e1cad16127bfe7a652e329b52ec439f193b26c71d260dca2fd136",
"index": 0
}
],
"outputs": [
{
"address": "addr_test1qrvx8wgdndrk98qf62vka3q4fglchk7h940vepdtgcv9fuu0e0aeuac6j2xhz77esaaudku68ha89qesqvd29pmuzw6qk8xkcn",
"amount": {
"coin": "1176630",
"multiasset": {
"1af660e4c58514a2f0ea167deca340381e55bed4aea60bc09c211417": {
"416e76696c5465737431323038": "1"
}
}
},
"plutus_data": null,
"script_ref": null
},
{
"address": "addr_test1qrzw0ps5u6a0j5732jnmpvt7wcn95hag36vcsdpdkrcmzur96fgsjkxwgdpq3ct9g6u4zfykrqjvl3knh4gcwe39ngzqkwyfvm",
"amount": {
"coin": "401154395",
"multiasset": null
},
"plutus_data": null,
"script_ref": null
}
],
"fee": "252013",
"ttl": "72405931",
"certs": null,
"withdrawals": null,
"update": null,
"auxiliary_data_hash": null,
"validity_start_interval": null,
"mint": null,
"script_data_hash": null,
"collateral": null,
"required_signers": null,
"network_id": null,
"collateral_return": null,
"total_collateral": null,
"reference_inputs": null,
"voting_procedures": null,
"voting_proposals": null,
"donation": null,
"current_treasury_value": null
},
"witness_set": {
"vkeys": null,
"native_scripts": null,
"bootstraps": null,
"plutus_scripts": null,
"plutus_data": null,
"redeemers": null
},
"is_valid": true,
"auxiliary_data": null
}
This transaction uses the send asset function to transfer an NFT between two addresses on the preprod network.
Last updated
Was this helpful?