Offline signing, deserialization exception

When using the /construction/payloads interface to build an unsigned_transaction , and then using the Transaction.deserialize(HexUtil.decodeHex(unsigned_transaction)) method from GitHub - bloxbean/cardano-client-lib: Cardano client library in Java for deserialization, an error occurred. The error is as follows:

Caused by: com.bloxbean.cardano.client.exception.CborDeserializationException: Invalid no of items
	at com.bloxbean.cardano.client.transaction.spec.Transaction.deserialize(Transaction.java:144)

/construction/payloads
Request parameters:

{
    "network_identifier": {
        "blockchain": "cardano",
        "network": "mainnet"
    },
    "operations": [
        {
            "operation_identifier": {
                "index": 0
            },
            "type": "input",
            "account": {
                "address": "addr1qxpk7jpjvaexq5uws3d3vyw65hj7lr0857c59fydrqeztgn0xtjzsg9zn50nrswqawem5qtuk7t9m4cx27xtqfhkgfjsp9fy8f"
            },
            "amount": {
                "value": "-17012170",
                "currency": {
                    "symbol": "ADA",
                    "decimals": 6
                }
            },
            "coin_change": {
                "coin_identifier": {
                    "identifier": "d56859256fec1a6d3f34a19027ee647b23690ab2dc43c281d77c2f7bcd6d1372:0"
                },
                "coin_action": "coin_spent"
            }
        },
        {
            "operation_identifier": {
                "index": 1
            },
            "type": "output",
            "account": {
                "address": "addr1q82yrpffkgkpd5mxfg5nrlq957tjjudczj280kccqwmyrdex0l8rgylfceqp89q2x79alwjn383gzuhxgx9ps3ene2gsm4ah6c"
            },
            "amount": {
                "value": "2000000",
                "currency": {
                    "symbol": "ADA",
                    "decimals": 6
                }
            }
        },
        {
            "operation_identifier": {
                "index": 2
            },
            "type": "output",
            "account": {
                "address": "addr1qxpk7jpjvaexq5uws3d3vyw65hj7lr0857c59fydrqeztgn0xtjzsg9zn50nrswqawem5qtuk7t9m4cx27xtqfhkgfjsp9fy8f"
            },
            "amount": {
                "value": "15000000",
                "currency": {
                    "symbol": "ADA",
                    "decimals": 6
                }
            }
        }
    ],
    "metadata": {
        "ttl": "171367670",
        "protocol_parameters": {
            "coinsPerUtxoSize": "4310",
            "maxTxSize": 16384,
            "maxValSize": 5000,
            "keyDeposit": "2000000",
            "maxCollateralInputs": 3,
            "minFeeCoefficient": 44,
            "minFeeConstant": 155381,
            "minPoolCost": "170000000",
            "poolDeposit": "500000000",
            "protocol": 10
        }
    }
}

Response result:

{
    "unsigned_transaction": "8279016a6134303038313832353832306435363835393235366665633161366433663334613139303237656536343762323336393061623264633433633238316437376332663762636436643133373230303031383238323538333930316434343138353239623232633136643336363461323933316663303561373937323937316238313439343737646231383033623634316237323637666365333431336539633634303133393430613337386264666261353338396532383137326536343138613138343733336361393131613030316538343830383235383339303138333666343833323637373236303533386538343562313631316461613565356566386465376137623134326134386431383332323561323666333265343238323061323964316633316331633065626233626130313763623739363564643730363537386362303236663634323635316130306534653163303032313932663861303331613061333664636636a16a6f7065726174696f6e7381a5746f7065726174696f6e5f6964656e746966696572a165696e64657800647479706565696e707574676163636f756e74a16761646472657373786761646472317178706b376a706a7661657871357577733364337679773635686a376c72303835376335396679647271657a74676e3078746a7a7367397a6e35306e727377716177656d357174756b3774396d346378323778747166686b67666a7370396679386666616d6f756e74a26576616c7565692d31373031323137306863757272656e6379a26673796d626f6c6341444168646563696d616c73066b636f696e5f6368616e6765a26f636f696e5f6964656e746966696572a16a6964656e7469666965727842643536383539323536666563316136643366333461313930323765653634376232333639306162326463343363323831643737633266376263643664313337323a306b636f696e5f616374696f6e6a636f696e5f7370656e74",
    "payloads": [
        {
            "account_identifier": {
                "address": "addr1qxpk7jpjvaexq5uws3d3vyw65hj7lr0857c59fydrqeztgn0xtjzsg9zn50nrswqawem5qtuk7t9m4cx27xtqfhkgfjsp9fy8f"
            },
            "hex_bytes": "0246760f72dae12e0b8f518576133bda8d2afb5a4217887df325c85250dad1c5",
            "signature_type": "ed25519"
        }
    ]
}

The rosetta-java /payload response for unsigned_transaction has wrapped rosetta CBOR structure that itself contains another CBOR object inside it which is actual transaction that be decoded by the Cardano client library. So initally you would have to a normal CBOR decode and get the inside transaction CBOR structure and then decode it using the the Cardano client library.

If you paste your CBOR on the right side here at https://cbor.me/ and click on ← button in the shown image, it will give you actual txn CBOR. You can use any cbor libraries in your preferd language for this.

We are an exchange. We previously used the Blockfrost service, but it is unstable. Therefore, we are using cardano-rosetta-java to set up our own node to ensure service stability. At the same time, our offline signing logic cannot change, and we still need to use the account.sign(transaction) method from cardano-client-lib. Currently, the unsigned_transaction generated by the /construction/payloads interface, after decoding, still cannot be deserialized using Transaction.deserialize(HexUtil.decodeHex(“”)). Can you provide more detailed steps?

replied you on the github - How to use cardano-client-lib to sign the unsigned_transaction generated by the /construction/payloads interface? · Issue #651 · cardano-foundation/cardano-rosetta-java · GitHub