Priya
Priya

Reputation: 51

Generate digest/ binary blob for XRP raw transaction using rippled c++ library

I have an offline signing code to which I need to pass the digest or the binary blob to get the signature. Looks like the digest I have produced is not right as when I try to submit the serialized signature, it complains of "fails local checks: Invalid signature." Here are the steps, I am doing to generate the digest/binary blob

  STTx noopTx(ttPAYMENT,
    [&](auto& obj)
{
    // General transaction fields
    obj[sfAccount] = id;
    obj[sfFee] = STAmount(XRPAmount(fee));
    obj[sfFlags] = tfFullyCanonicalSig;
    obj[sfSequence] = sequence;
    obj[sfSigningPubKey] = pub_key.slice();
    // Payment-specific fields
    obj[sfAmount] = STAmount(XRPAmount(amount));
    obj[sfDestination] = *to_account;
    obj[sfSendMax] = STAmount(XRPAmount(amount));
});
ripple::uint256 hash256 = noopTx.getSigningHash();

output: 0861970E8AAC8539600E2FB9169774F303A29C3B8CA98FF9206C9B958C681ACF

Please can someone tell me if I am missing any field that is needed?.

Upvotes: 3

Views: 136

Answers (0)

Related Questions