Closed junha-ahn closed 2 years ago
The fee for multisigning is a little different: https://xrpl.org/multi-signing.html
The prepareTransaction
method will actually calculate the correct fee for you, as long as you have signersCount
(the number of total signers) in the instructions
- so you don't need to do it separately yourself.
"The prepareTransaction method will actually calculate the correct fee for you"
But I think the getFee()
function can't calculate the correct fee now.
Look at the log above the submit()
function return to me "telINSUF_FEE_P"
And There is a same sequence function so I think prepareTransaction()
is same for getFee()
function ....
Is there any other way to recommend?
getFee()
only returns the fee for a standard transaction, so it won't work for a multisigned transaction.
Not sure what you mean by a "same sequence function" - I don't quite follow what the problem you're having is there.
thank you
"getFee() only returns the fee for a standard transaction, so it won't work for a multisigned transaction."
I have two signatures (in multi sign address)
so If the "standard fee"(getFee() result
) is a "1 XRP", I have to set "3 XRP" for my multisigned transaction
1 XRP * 3 = 3 XRP
)And Sorry, My mistake.
Look at my log, there are 8 transactions (log) but the sequence is all same.
I would just let prepareTransaction
calculate the fee for you (which it will do if you leave the Fee
field blank). It will automatically do the math for you (the normal fee is not 1 XRP, it's ~10 drops of XRP, which is about .00001 XRP).
The sequence is the same because your transaction failed. The sequence only increments with a successful transaction.
Ah, I understand now!!!!
Thank you and I will change my logic
prepareTransaction
MaxFee
field in instructions Because I am afraid that an unexpected amount of fee will be paid. (Is it work?)(My last question) But Is it ok "sign
and combine
" after prepareTransaction()
Because I think, We don't know how many signatures do we need, It just automatically calculate after combine
?
Re 2: the default MaxFee
is 2 XRP, so you shouldn't be able to pay more than that. You can set it to a different global value when you initialize the RippleAPI
. But you can also set a different MaxFee
for this specific transaction.
You'll need to know the number of signatures at the time of prepareTransaction
, for the fee calculation. You'll definitely need to know the number of signatures at the time of each sign
, if you want to re-calculate the fee by hand just before signing.
If you're referring to the signer quorum, the transaction will fail if you don't have enough signatures. You can also find out what the quorum is with an account_info
request.
Ok Thank you for sharing about default MaxFee
"You'll need to know the number of signatures at the time of prepareTransaction"
I know the number of signatures in my account
so, for calculate fee
what I need to do in prepareTransaction()
argument, Do I need to fill the "Signers" filed?
Is there a example for multisign transaction with ripplejs?
You can pass a signersCount
into prepareTransaction
The way that multisigning works with the library is that you sign each transaction individually, and then you combine them into one transaction using combine
. When preparing each individual transaction, put the total number of signers in the instructions.
Thank you! All your help!!! What an amazing!
async function multiSignPayment(paymentObject) {
const { from, to, amount, tag } = paymentObject
const multiSignPayment = {
TransactionType: 'Payment',
Account: from,
Destination: to,
Amount: amount,
// no Fee filed
}
const instructions = {
maxLedgerVersionOffset: 25,
signersCount: 2, // Added
}
if (tag) multiSignPayment.DestinationTag = Number(tag)
const prepared = await rippleAPI.prepareTransaction(
multiSignPayment,
instructions
)
// The bottom is all the same.
const signers = await Secrets.getSigners()
const signedTransactions = signers.map(({ address, account, secret }) => {
const addr = address || account
return rippleAPI.sign(prepared.txJSON, secret, { signAs: addr })
.signedTransaction
})
const combinedTx = rippleAPI.combine(signedTransactions)
return await rippleAPI.submit(combinedTx.signedTransaction)
}
rippled node version 1.7.3
Hi, I have some problem with "XRP sending"
I think It's not a bug or something, It might be my mistake. so plz tell me some tips to do
If you look at my log, The transactions have the same Sequence (xxx)
And only the last transaction was successful.
Time is not even close. 00:53 ~ 1:03 (during 10 minutes)
I think the transaction fee is too low so all Transaction just in Queue
so My first question is "How to calculate exact FEE, and fast FEE" so my transaction will Success very fast
and I think I can specify a specific sequence. (sequence filed In the instruction obj)
And that's not a good idea, because if the "A transaction" fails, the sequence of other transactions executed after "A transaction" must be corrected.
So what can I do I want to know how can I fix this problem
Summary
Thank you for your help.