eos icon indicating copy to clipboard operation
eos copied to clipboard

You can try embedding eosio nonce action inside your transaction to ensure uniqueness.

Open lingyiliu016 opened this issue 8 years ago • 9 comments

when I push action on twice, error occured! details are as follows: cleos push action child.acnt ercbalanceof '["child.acnt"]' -p child.acnt Error 3040008: duplicate transaction You can try embedding eosio nonce action inside your transaction to ensure uniqueness. Error Details: duplicate transaction 798086f342c8261ff0324253a6b5362f7cfb64f4280e9aea5e8d017581fb538b what should I do? How can I embedding eosio nonce action inside my transaction? give me some suggesstion,please!

lingyiliu016 avatar May 29 '18 11:05 lingyiliu016

Just add -f option like that :

cleos push action child.acnt ercbalanceof '["child.acnt"]' -p child.acnt -f

maxb14 avatar May 29 '18 11:05 maxb14

@lingyiliu016 "duplicate transaction" maybe a sign of another problem - your nodeos is not producing blocks. Otherwise transactions submitted even with 1 second interval should be unique since they reference different head blocks (even if all other fields in the transactions are exactly the same). In your case head block seem to be not advancing.

Meanwhile I am closing this ticket - there is no issue with EOS software and there is no information to say what was wrong with nodeos (most likely block production was not enabled).

moskvanaft avatar Jun 05 '18 22:06 moskvanaft

1 second is a long time if your running a test suite where calls take fractions of a second. I'm having the same issue but using eosjs, which I don't believe supports an equivalent of --force-unique. any recommendations?

ekkis avatar Jun 02 '19 05:06 ekkis

You can add an attribute to your action and send a random number or incrementing number. Or add a memo field and add unique strings.

heifner avatar Jun 03 '19 12:06 heifner

I had tried sending a random number in the memo field but it didn't work. I also read in other posts about the inclusion of a "nonce" though I find no authoritative documentation on how that might be done

ekkis avatar Jun 03 '19 17:06 ekkis

Here is how nonce is done in cleos

chain::action generate_nonce_action() {
   return chain::action( {}, config::null_account_name, name("nonce"), fc::raw::pack(fc::time_point::now().time_since_epoch().count()));
}

heifner avatar Jun 03 '19 17:06 heifner

in my case the transaction is composed in eosjs. I'm not yet familiar with creating transactions from c++

in fact, what's odd is that if I change the amount I'm transferring it solves the problem, but adding a memo field with a random number doesn't

ekkis avatar Jun 03 '19 17:06 ekkis

Sorry, I'm not familiar with eosjs. Maybe ask there. A random number on memo should work just fine.

heifner avatar Jun 03 '19 17:06 heifner

@ekkis, Check eoslime, the JS framework supports it

bakasura980 avatar Sep 16 '19 05:09 bakasura980