Author

Topic: many tiny transaction from mining --> Error: Transaction creation failed (Read 1298 times)

hero member
Activity: 826
Merit: 1000
see my profile
sendmany.sh
Bundle thousands of tiny transactions in dozens of small transactions to restore the health of a wallet which has been polluted by p2pool microtransactions

This script below sends out many transactions in one go, to the same address.
So the tiny incoming transactions are bundled up to small outgoing transactions
which can be sent back as one big transaction. Problem solved.

This is an example in which all goes well with my script and the parameters, using the command:

Code:
./sendmany.sh ~/C-Note/c-noted  CTVHuvvdJj61fC1mzFAQ4V1TrYBb8QTpiA 3 10 BundlingUpSmallTransactions

the output is:

Code:
I will use /root/C-Note/c-noted to send 3 packages of size 10 to CPuubkhAgXG1b1XCVbrt4rCW2E1cWAXokq with message BundlingUpSmallTransactions
Press Ctrl-C if you do NOT want that, or ENTER if you agree... Good. Let us start.
Balance before the action was 51.10549
BEFORE=51.10549000 AFTER=41.10429000 TX-ID=6d828c...
BEFORE=41.10429000 AFTER=31.10299000 TX-ID=bc766b...
BEFORE=31.10299000 AFTER=21.10149000 TX-ID=01059b...
Ready.
In total, including transaction fees, 30.004 were sent.
Balance after all that action now is: 21.10149


If the package size is still too large (and thus would bundle too many tiny transactions into one), like in my case with

Code:
./sendmany.sh ~/C-Note/c-noted CTVHuvvdJj61fC1mzFAQ4V1TrYBb8QTpiA 3 50 BundlingUpSmallTransactions

then the result is like this:

Code:
I will use /root/C-Note/c-noted to send 3 packages of size 50 to CPuubkhAgXG1b1XCVbrt4rCW2E1cWAXokq with message BundlingUpSmallTransactions
Press Ctrl-C if you do NOT want that, or ENTER if you agree... Good. Let us start.
Balance before the action was 144.11369000
error: {"code":-4,"message":"Transaction too large"}
error: {"code":-4,"message":"Transaction too large"}
error: {"code":-4,"message":"Transaction too large"}
Ready.
In total, including transaction fees, 0 were sent.
Balance after all that action now is: 144.11369000


I guess that's it. My script solved my problem. May it solve yours, too.

Here it is: "sendmany.sh" incl short instructions
https://github.com/drakoin/LinuxWallet/blob/master/sendmany.sh



All the problems my script ran into (no daemon there at all, tx still too large, insufficient funds, etc.) are caught now, and should not cause problems anymore. Only the ones that haven't happened, might still cause problems :-) If you run this, read the script before, so that you understand what it does. No guarantees whatsoever. Your own risk.

But still - may it help you  Wink
sr. member
Activity: 425
Merit: 253
Alright, that was a long day. My C-Notes wallet was very ill.
But I solved the problem, by scripted sending of many transactions - whew. Yiehah!

1) I had won the auction of GRID shares and wanted to send C-Notes for that - but my wallet was suddenly very ill.
2) So I documented the problem in that altcoin thread about C-notes, and asked for help.
3) The existing block explorer does not help to find out what's going on  - we will get a better one.
4) I was almost sure that I had understood the problem, now I was searching for a solution.
5) I searched in many places, then asked for script here, and in pywallet.
6) I could have made a simple Windows Batch script, but the Dev had only compiled the qt-wallet for us, not the really useful headless CLI wallet daemon.
7) What about accessing the wallet through its built-in JSON RPC-Server? (Until today I hadn't used my www browser to look at my wallet, coooool.)
Cool But hey - I suddenly thought: For linux I have a CLI client, because I hadcompiled it myself. So I transferred the wallet.dat with PSCP.exe up into the cloud.
9) But then the wallet.dat seemed incompatible. Aaaarrghhh. Learnt a bit about the qt-sourcecode - but I could only get so far without the dev who compiled the windows-qt wallet.
10) In the end the only thing it needed was redownloading the blockchain. Wallet transfer = new blockchain download!
11) Then I could finally start to write that simple script. I am still new to linux-scripting, so I ran into many stupid problems...
12) Wow, I can catch exit code AND programm output: A=$(command parameter); if [ "$?" != "0" ]; then ...
13) I did not expect that subtracting non-integer values could problematic. Didn't get it. Solved it with $(echo $a-$b | bc)
14) But I could not code my strategy: I wanted to send transaction until the final balance was just under the target balance. But I just could not get the while-condition to work for me, probably because of the float values?  My workaround was ... giving up, and instead using a for (( i = 1 ; i <= $3 ; i++ )) loop, and catching the error if the balance would run out.
15) It works. YIIIIEHAAAH! Yeah! Yippieh.
16) With my script I have sent all 2000 tiny funds in a few dozen many small packages to wallet2, and from there in one big transaction back to wallet1.

So here we are. Ready. My wallet is healthy again.

All asking today did not really result in much help. Have I asked in the wrong way, or in the wrong places?
It was as if bitcointalk was empty, and everyone knowledgable on holidays :-)

I solved it alone. And a few other things on the way.  What a learning experience!

Thanks bitcoin, you are some nerdy playground :-)

You like that detective story? My donation address is  BTC 1JLKNFxKjkU3YsLs38y4e672iWiXBeFYP3
or C-Notes CTVHuvvdJj61fC1mzFAQ4V1TrYBb8QTpiA or many other at www.tiny.cc/drakointip


The guy who did the Windows installer is "shakazula"  - I dont think he's active any more... he kind of fell off the planet...
hero member
Activity: 826
Merit: 1000
see my profile
Alright, that was a long day. My C-Notes wallet was very ill.
But I solved the problem, by scripted sending of many transactions - whew. Yiehah!

1) I had won the auction of GRID shares and wanted to send C-Notes for that - but my wallet was suddenly very ill.
2) So I documented the problem in that altcoin thread about C-notes, and asked for help.
3) The existing block explorer does not help to find out what's going on  - we will get a better one.
4) I was almost sure that I had understood the problem, now I was searching for a solution.
5) I searched in many places, then asked for script here, and in pywallet.
6) I could have made a simple Windows Batch script, but the Dev had only compiled the qt-wallet for us, not the really useful headless CLI wallet daemon.
7) What about accessing the wallet through its built-in JSON RPC-Server? (Until today I hadn't used my www browser to look at my wallet, coooool.)
8) But hey - I suddenly thought: For linux I have a CLI client, because I hadcompiled it myself. So I transferred the wallet.dat with PSCP.exe up into the cloud.
9) But then the wallet.dat seemed incompatible. Aaaarrghhh. Learnt a bit about the qt-sourcecode - but I could only get so far without the dev who compiled the windows-qt wallet.
10) In the end the only thing it needed was redownloading the blockchain. Wallet transfer = new blockchain download!
11) Then I could finally start to write that simple script. I am still new to linux-scripting, so I ran into many stupid problems...
12) Wow, I can catch exit code AND programm output: A=$(command parameter); if [ "$?" != "0" ]; then ...
13) I did not expect that subtracting non-integer values could problematic. Didn't get it. Solved it with $(echo $a-$b | bc)
14) But I could not code my strategy: I wanted to send transaction until the final balance was just under the target balance. But I just could not get the while-condition to work for me, probably because of the float values?  My workaround was ... giving up, and instead using a for (( i = 1 ; i <= $3 ; i++ )) loop, and catching the error if the balance would run out.
15) It works. YIIIIEHAAAH! Yeah! Yippieh.
16) With my script I have sent all 2000 tiny funds in a few dozen many small packages to wallet2, and from there in one big transaction back to wallet1.

So here we are. Ready. My wallet is healthy again.

All asking today did not really result in much help. Have I asked in the wrong way, or in the wrong places?
It was as if bitcointalk was empty, and everyone knowledgable on holidays :-)

I solved it alone. And a few other things on the way.  What a learning experience!

Thanks bitcoin, you are some nerdy playground :-)

You like that detective story? My donation address is  BTC 1JLKNFxKjkU3YsLs38y4e672iWiXBeFYP3
or C-Notes CTVHuvvdJj61fC1mzFAQ4V1TrYBb8QTpiA or many other at www.tiny.cc/drakointip
hero member
Activity: 826
Merit: 1000
see my profile
EDIT: Solved. See below.

sendmany.sh

Bundle thousands of tiny transactions into dozens of small transactions
to restore the health of a wallet which has been polluted by p2pool microtransactions


This script below sends out many transactions in one go, to the same address.
...

..  .. . . .. . ..  ...... .. .. . . . .. . . ... .. . . . . . . . . . . . .. .. .. . . . . . ..  .. . . ... . ..  .. . . ..  . ..  .
..  .. . . .. . ..  ...... .. .. . . . .. . . ... .. . . . . . . . . . . . .. .. .. . . . . . ..  .. . . ... . ..  .. . . ..  . ..  .
..  .. . . .. . ..  ...... .. .. . . . old posting #1 following now .. .. . . . . . ..  .. . . ... . ..  .. . . ..  . ..  .
..  .. . . .. . ..  ...... .. .. . . . .. . . ... .. . . . . . . . . . . . .. .. .. . . . . . ..  .. . . ... . ..  .. . . ..  . ..  .
..  .. . . .. . ..  ...... .. .. . . . .. . . ... .. . . . . . . . . . . . .. .. .. . . . . . ..  .. . . ... . ..  .. . . ..  . ..  .
.
.

This is probably a well known problem:
https://bitcointalksearch.org/topic/m.5378737

Code:
Transaction too large
Code:
Error: Transaction creation failed

How to solve it?

What is the limit?

Where is a script which compiles small amounts to increasingly larger ones?

Jump to: