Search code examples
stellar

How to extract already signed public keys from a transaction envelope decoded from XDR?


I'm working with a transaction envelope that I decoded from XDR, and I'm trying to extract the signed public keys from it. Here's a truncated version of the envelope:

{
    "_networkPassphrase": "Diamante Testnet",
    "_tx": {...:...},
    "_signatures": [
        {
            "_attributes": {
                "hint": {
                    "type": "Buffer",
                    "data": [
                        41,
                        45,
                        157,
                        51
                    ]
                },
                "signature": {
                    "type": "Buffer",
                    "data": [
                        101,
                        246,
                        73,
                        218,
                        181,
                        85,
                        247,
                        161,
                        150,
                        190,
                        226,
                        209,
                        120,
                        177,
                        38,
                        199,
                        4,
                        28,
                        46,
                        104,
                        141,
                        211,
                        45,
                        114,
                        239,
                        224,
                        135,
                        240,
                        178,
                        124,
                        255,
                        118,
                        79,
                        193,
                        249,
                        82,
                        114,
                        111,
                        168,
                        70,
                        62,
                        213,
                        115,
                        79,
                        215,
                        94,
                        60,
                        11,
                        114,
                        23,
                        227,
                        251,
                        17,
                        28,
                        219,
                        16,
                        169,
                        93,
                        51,
                        216,
                        35,
                        12,
                        148,
                        14
                    ]
                }
            }
        }
    ],
    ...
}

I've tried decoding the hint field, but I wasn't successful. Could someone please guide me on how to extract the signed public keys from this transaction envelope? Any help would be appreciated.


Solution

  • https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md

    According to this, The hint shows the first last 4 bytes of the ed25519 public key.