Ripple tecPATH_DRY error

Free training on Ripple development. Click here for details.


If you are trying to  do a payment transaction and using issued currency (eg. USD) for the payment, you may come across below error during the transaction : 

{ resultCode: 'tecPATH_DRY',  resultMessage: 'Path could not send partial amount.' }

The reason for above error is that for transactions involving issued currency , a trustline has to be established between sender and receiver before doing the actual transaction like Payment. 

Fix:

To fix the issue, create a trustline transaction as illustrated below . Note that the counter party in the trustline should be sender address and the trustline transaction should be prepared and signed by receiver as highlighted in bold below.

//payload for trustline
trustlineTxt={
"currency":"USD",
"counterparty":sender,
"limit":""+trustlineAmount
     }

trustlineTxtJSON = {}
txres=''
api.prepareTrustline(receiver,trustlineTxt).then((response)=>{
trustlineTxtJSON=response.txJSON
signed_tx = api.sign(trustlineTxtJSON, receiverSecret)
txres=api.submit(signed_tx.signedTransaction)
})
console.log(txres)

Once you have the trustline created , you can execute your payment (or other transactions) using the issued currencies.

Comments

Popular posts from this blog

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 18): AssertionError [ERR_ASSERTION]: issuer must be defined