PSA: If you’ve frequently claimed GAS on your Ledger…

Tyler
Proof of Working
Published in
4 min readSep 10, 2021

There’s a quirk of Neo2+Ledger that a lot of Ledger users may find out about first-hand once Ledger migration support is available in the coming days.

Neo2 (the legacy chain) uses a UTXO model for NEO/GAS transfers, similar to Bitcoin. What does this mean? It means your balance isn’t just a number recorded on the blockchain, it’s the sum total of all “outputs” of previous transactions where you received NEO/GAS. When you make a new transaction, the wallet finds all your previous transactions where the output hasn’t already been spent, and uses them as the “input” to the next transaction, which becomes the “output” to the next transaction, and so on.

Ordinarily this is transparent to you, the wallet user, until you start getting into the territory of 20 inputs to a transaction. You see, each input reference to the transaction takes up a certain amount of bytes. Once you hit around 20 inputs (this can vary depending on what else is included in the transaction), the total transaction size starts to exceed 1024 bytes.

Why does this particular number of 1024 bytes matter? Well, that’s the limit for how large a free transaction on Neo2 can be — above this size you have to pay a small fee per extra byte. In most cases, this isn’t a big deal, but if you have a lot of inputs the fee start to add up.

But where this limit of 1024 bytes really starts to matter is for Neo2 Ledger users. The Ledger has a very small amount of working RAM, and has a hard limit of 1024 bytes for a transaction. So if you exceed that size, you simply won’t be able to make the transaction, even if you add the extra fee. Again, most users who simply purchased NEO or GAS a few times and sent it to their Ledger probably won’t have any issues at all. But — there are some of you who really like to claim GAS on a regular basis. There’s really no reason to claim GAS frequently, since it doesn’t earn you any more than claiming it all at once right before you transfer it. But it’s kind of fun to hit that claim button and see your balance go up, right?

So therein lies the problem — each and every prior GAS claim is a transaction that becomes a UTXO input to your next transaction that spends the GAS. So it’s quite easy to get yourself into a situation where your GAS gets “stuck” on the Ledger because you’ve done too many claims with it, and you see the dreaded “transaction is too large for the Ledger to sign” error message in your wallet.

So how do you fix this issue if it happens to you? Well, you have to consolidate your UTXO inputs, i.e. make transactions of fewer than 20 inputs and send them back to yourself, which condenses those inputs into a single output. But the wallet only lets you deal in amounts, not numbers of inputs, so how do you know how much GAS to send so that it only adds up to fewer than 20 inputs?

One way is just through trial-and-error. Try sending half of your GAS from your Ledger address to your Ledger address (that’s right, you’re sending it to your own address. You end up with the same amount (minus any network fee) but in the end you have consolidated multiple inputs into one). If you still get an error when sending half, try sending half of that. If that still returns an error, try halving the amount over again until you no longer get an error. Eventually you’ll have the total number of UTXO inputs reduced to a number that will fit into a 1024-byte transaction all at once. But that’s a lot of work, right?

Fortunately the community has built a couple of tools to help manage this process. The first is the O3 UTXO Manager app, available at https://utxo-manager.o3.app/ — you can connect using the O3 Wallet and automate the process of making UTXO consolidation transactions. Another tool is the UTXO calculator from Splyse, available at https://srp.splyse.tech/ledgercalc/ — this will show you the raw information about the UTXO amounts for any address, and help you figure out the maximum amount you can send in a 1024-byte transaction without all the trial-and-error.

Finally, if you get stuck and just can’t seem to figure out how any of this works, there is a support channel in the Neo Discord at https://discord.gg/yM6q7Sp2py, where you can get answers to questions about this process or any technical questions you may have about using or developing on the Neo blockchain.

-Hal0x2328

--

--