XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.2k stars 511 forks source link

signedTransaction invalid #764

Closed AdvancedStyle closed 7 years ago

AdvancedStyle commented 7 years ago

I have setup a simple offline signing script, however the "signedTransaction" blob that is returned is not valid when submitting to a ripple server. Here is my code (details redacted) below:

(Note that the account/seed I'm using when generated using the ripple-lib generateAddress() )

` const {RippleAPI} = require('ripple-lib');

const api = new RippleAPI();

var account = 'rMYFROMACCOUNT'; var destination = 'rTHEDESTACCOUNT'; var amount = 11;

const txJSON = '{"TransactionType":"Payment","Account":"'+account+'","Destination":"'+destination+'","DestinationTag":1,"Amount":"'+(amount * 1000000)+'","Sequence":1,"Fee":"100"}'; const secret = 'sMYSEED'; console.log(api.sign(txJSON, secret)); `

This successfully returned a {signedTransaction, id}, then i copy it into a CURL request to submit but the ripple server returns error_code: 30 (invalidparams). Which is the same error when you try to submit any invalid blob data.

AdvancedStyle commented 7 years ago

Nevermind I figured out the problem was that I needed to set:

"Flags": 2147483648

in txJSON