1

I have a JSON representation of an XRPL transaction, like the one below, and I want to sign it in C++ using rippled. How can I?

{
  "TransactionType" : "Payment",
  "Account" : "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
  "Destination" : "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
  "Amount" : "1000000"
}
John Freeman
  • 2,552
  • 1
  • 27
  • 34

1 Answers1

0
  1. Parse a transaction, represented by the class STTx (which stands for "serialized type: transaction"), from JSON. ripple-libpp has good example code.
  2. Construct a signing key, represented by the type SecretKey. If you have a Base58-encoded signing key, you can use parseBase58 (pass TokenType::AccountSecret for the first parameter).
  3. Derive the verifying key (represented by the class PublicKey) from the signing key with derivePublicKey (pass KeyType::secp256k1 or KeyType::ed25519 for the first parameter, depending on the signing algorithm you choose to use).
  4. Sign the transaction with STTx::sign.
  5. Read the signature via Blob const signature = sttx.getFieldVL(sfTxnSignature) (a Blob is a vector of bytes).
John Freeman
  • 2,552
  • 1
  • 27
  • 34