I Get “Transaction Size Is Too Big, Please Optimize Your Wallet” Or “Transaction Is Too Big” Errors, What Should I Do?

Often, this is because of a lot of small incoming transactions. With the command line Conceal wallet, you can optimize your wallet to send larger transactions or a single big transaction. See this guide on wallet optimization. Service providers using the RPC Wallet, should look at the guide on [Fusion Transactions](Fusion-Transactions).

A common issue for any service provider is the “Transaction is too big” error when trying to execute a transaction. The Cryptonote protocol uses denominations when sending funds and as a result after a lot of incoming transactions, that wallet address can up with hundreds, or even thousands of small outputs.

The solution, for anyone that uses our RPC Wallet, wallet, is to use fusion transactions to consolidate all the smallest outputs, so that users can send larger amounts. The more outputs you have, the more fusion transactions you will need to do. Fusion transactions use a threshold value to determine how many outputs to fuse. Always use atomic units for the threshold value. For example, if you want to fuse all inputs smaller than 1 CCX, then the threshold will need to be 1000000.

Fusion transaction follows a two-part process:

  1. First use the estimateFusion RPC call to determine the best threshold to optimize.
  2. Then use sendFusionTransaction to fuse those outputs.

Step 1 - EstimateFusion

In the examples below, we will look at using estimateFusion to see how many inputs we can fuse for a specific address in the wallet. If the wallet contains only one address, you can omit this parameter.

Example 1: with a single Wallet address:

{
   "params":{
      "addresses":[
         "ccx7FWKwU67Juvyw5JNmyCEWnEQLCJs196hpHYCbSCWGGykBFZnUnhfLhJUWwU1ixvVTadF5pdGteTMpZyKs5A1D1Lrv8ttyY3"
      ],
      "threshold":1000000
   },
   "jsonrpc":"2.0",
   "id":"test",
   "method":"estimateFusion"
}

The output:

{
   "id":"test",
   "jsonrpc":"2.0",
   "result":{
      "fusionReadyCount":298,
      "totalOutputCount":301
   }
}

Example 2: with another wallet address from the same container:

{
   "params":{
      "addresses":[
         "ccx7MxD8iGAgbvsQojKgZWCz1hzhAZ6RWcjoKgF3Cc9zCzG7xmP1fvRLhJUWwU1ixvVTadF5pdGteTMpZyKs5A1D1Lrv8afeB3"
      ],
      "threshold":1000000
   },
   "jsonrpc":"2.0",
   "id":"test",
   "method":"estimateFusion"
}

The output:

{
   "id":"test",
   "jsonrpc":"2.0",
   "result":{
      "fusionReadyCount":0,
      "totalOutputCount":63
   }
}

Example 3: without specifying the address (this will show the total outputs for all wallets in the container:

{
   "params":{
      "threshold":1000000
   },
   "jsonrpc":"2.0",
   "id":"test",
   "method":"estimateFusion"
}

The output:

{
   "id":"test",
   "jsonrpc":"2.0",
   "result":{
      "fusionReadyCount":343,
      "totalOutputCount":364
   }
}

Note: Please remember that you need to specify the addresses param as an array of strings or you will get the outputs for all the addresses in your container.

Step 2 - SendFusionTransaction

Now that we have determined that we can use fusion transactions to optimize the wallet, we can go ahead and use sendFusionTransaction with the same above threshold. Once again, if the wallet only contains one address, you can omit the use of the address in the parameters.

Example: with Wallet address:

{
   "params":{
      "addresses":[
         "ccx7FWKwU67Juvyw5JNmyCEWnEQLCJs196hpHYCbSCWGGykBFZnUnhfLhJUWwU1ixvVTadF5pdGteTMpZyKs5A1D1Lrv8ttyY3"
      ],
      "threshold":1000000,
      "anonymity":0
   },
   "jsonrpc":"2.0",
   "id":"test",
   "method":"sendFusionTransaction"
}

The output:

{
   "id":"test",
   "jsonrpc":"2.0",
   "result":{
      "transactionHash":"ea749cd4cf407f5082ec2a20dc71692b470ad2fdf706aaa851ed3926d890c579"
   }
}

Note: If you use sendFusionTransaction on an address that does not have sufficient fuseable inputs, you will get an “index out of range” error.

What Happens We Have Thousands Of Outputs?

When dealing with a wallet where the number of smaller outputs have built up over time, then you will need to use smaller and smaller values for the threshold. In some cases, use a threshold of 10 or lower to fuse the smallest values. In the rare scenario where there are too many small outputs even at the lowest threshold, you will need to export the keys for that wallet and use the CLI or GUI wallets to run multiple optimization rounds.

For instructions on getting started with your RPC wallet please follow this guide. Visit our RPC Wallet API page for a listing of support API calls

Article Details

Article ID:
1
Category:
Views:
54
Rating (Votes):
(1)

Related articles