What this Error?

Example:

transaction A get nonce 1
transaction B get nonce 2
transaction C get nonce 3

But blockchain package B、C first, then package A. If happen this step, get error.

With truffle?

Because

Normal

  
const wallet = new HDWalletProvider(mnemonic, url, id);  
const AContract = new TruffleContract(Json_contract);  
AContract.setProvider(wallet);  
  
wallet.addresses[]  
AContract. use contract api  

Sometime you call contract “set/write” api two times.

Example:

Create contract first. Write data into contract second. This two step are in one function. This mean is you call two time “new HDWalletProvide”. Usually you think “New“ two time is ok, get “new” instance. But

https://github.com/trufflesuite/truffle-hdwallet-provider/blob/master/index.js

  
function HDWalletProvider(  
  mnemonic,  
  provider,  
  address_index=0,  
  num_addresses=1,  
  shareNonce=true,  
  wallet_hdpath="m/44'/60'/0'/0/"  
) {  

shareNonce default is true. new HDWalletProvide use same Nonce.

Answer is shareNonce => false, when you set/update data into to contract use api.