danielmcclure / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 1 forks source link

Impossible to create transaction without fee #620

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to create the transaction with fee = 0;
According to https://en.bitcoin.it/wiki/Transaction_fees#Sending
It's possible to create free transaction.

to create mature input with big amount. I implemented UTXOProvider and mock it. 
To create transaction I stubbed the input:

 List<UTXO> outputs = Arrays.asList(
                new UTXO(new Sha256Hash("a068afc619161450694d39c39d11e63b615432cee349774236884208e8ff7e90"), 2, Coin.parseCoin("9999999"), 1, false,
                        new Script(HEX.decode("a9142320e814fff4a7f9682aa46458cbe3a690e6a49287")), "34tkzeSo22R59XCY49r9ZaF42N98CXjMpN"));

I tried different amounts for output. However the resulting transaction is 
always have at least fee  0.00001 BTC.

For example:
015-05-04 21:07:19.051  INFO 12897 --- [           main] 
org.bitcoinj.core.Wallet                 : Completing send tx with 1 outputs 
totalling 200.00 BTC (not including fees)
2015-05-04 21:07:19.054  INFO 12897 --- [           main] 
org.bitcoinj.core.Wallet                 :   with 9999798.99999 BTC change
2015-05-04 21:07:19.054  INFO 12897 --- [           main] 
org.bitcoinj.core.Wallet                 :   with a fee of 0.00001 BTC
2015-05-04 21:07:19.063  INFO 12897 --- [           main] 
org.bitcoinj.core.Wallet                 :   completed:   
1577f12b8f58bd2d7f7273f0eb20a83c02db1d4886432041c361f0f56ea2d1fe: Unknown 
confidence level.
     in    9999999.00 BTC
          outpoint:a068afc619161450694d39c39d11e63b615432cee349774236884208e8ff7e90:2 hash160:2320e814fff4a7f9682aa46458cbe3a690e6a492
     out  DUP HASH160 PUSHDATA(20)[3e130ba395150ee427ff905eacc0c134d55c964a] EQUALVERIFY CHECKSIG 9999798.99999 BTC
     out  DUP HASH160 PUSHDATA(20)[3e130ba395150ee427ff905eacc0c134d55c964a] EQUALVERIFY CHECKSIG 200.00 BTC
     fee  0.00001 BTC

HEX = 
0100000001907effe808428836427749e3ce3254613be6119dc3394d6950141619c6af68a0020000
006e0000004c69522103832abbe9737befa67ea259fe06541c2585ba29462bc86f4fc67ac8235600
984a2103dd0cc537865c5f04eadd58812b63a2fcf39fcb8158673ef794608af57ebd58c721029db5
8dbf054452422f0b51d68f93b8ff4160f2f7a44edc2a7f3103ec3d872e2253aeffffffff0218d3b8
f6798d03001976a9143e130ba395150ee427ff905eacc0c134d55c964a88ac00c817a80400000019
76a9143e130ba395150ee427ff905eacc0c134d55c964a88ac00000000

I tried with both SendRequest.ensureMinRequiredFee = true, false

Original issue reported on code.google.com by an...@ambisafe.co on 4 May 2015 at 6:08

GoogleCodeExporter commented 9 years ago
Did you try setting SendRequest.feePerKb to Coin.ZERO and .ensureMinRequiredFee 
to false? I think that should do the trick.

Question like this are best asked on the mailing list:
https://groups.google.com/forum/#!forum/bitcoinj

Original comment by andreas....@gmail.com on 4 May 2015 at 6:25

GoogleCodeExporter commented 9 years ago
Then it doesn't calculate the fee for transactions greater than 1000 bytes

Original comment by an...@ambisafe.co on 4 May 2015 at 9:26