Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending multiple outputs in a single transaction results in 'transaction too large for fee policy' #302

Closed
gituser opened this issue Apr 18, 2017 · 11 comments

Comments

@gituser
Copy link

gituser commented Apr 18, 2017

Hi.

I'm using fundrawtransaction() to collect inputs for sending out and it seems to not work properly, I'm getting:

fundrawtransaction returned: array ( 'code' => -32603, 'message' => 'Transaction too large for fee policy', ),

Litecoin version is v0.13.2.1.

I'm testing on the testnet network.

$ ./litecoin-cli getinfo
{
  "version": 130200,
  "protocolversion": 70015,
  "walletversion": 60000,
  "balance": 16.45803239,
  "blocks": 1029556,
  "timeoffset": 0,
  "connections": 8,
  "proxy": "",
  "difficulty": 0.0002441371325370145,
  "testnet": true,
  "keypoololdest": 1492486802,
  "keypoolsize": 100,
  "paytxfee": 0.00010000,
  "relayfee": 0.00100000,
  "errors": ""
}

What could be the issue here?

Thanks.

@gituser
Copy link
Author

gituser commented Apr 19, 2017

OK, so the question is why feeRate should be set to 0.001 LTC and can't be 0.0001 LTC (which is the default value) for fundrawtransaction()

Here is what I'm doing:

$ ./litecoin-cli createrawtransaction "[]" "{\"mkEuBC3Eazz9FNBggDUb1hHmWCs6nZT3kv\":\"0.09008182\",\"n19qgZuxmmpTejJcmdov5CSaoWjuRc5pMR\":\"0.09008182\",\"mn1TW9Qzgb4UEVZjpG51UC3KjohVWbZzFw\":\"0.09008182\",\"mtXhUtM79CLqKxXtUnAxmKkPcBMJWAXtNE\":\"0.09008182\",\"mu4ka4dKBA4yWXDtVCENbLmQKxbHTAJTzu\":\"0.09008182\",\"mjceCPXqP6LQMvot3upiE7FvX7ajby88C7\":\"0.09008182\",\"miZPoRg8w2BGxRtcpfaYULsJReaMLArr51\":\"0.09008182\",\"n1MGAB4jTrGzZDsq5iaMnCfq2D6dae3PLZ\":\"0.09008182\",\"n35wyTYZTn1YXh9bYpHbJ8gL2FrFfuvKT2\":\"0.09008182\",\"mrhgKEzef2iJHBSUsstpo5zAev3b26rUAA\":\"0.09008146\",\"mu3oets6nzXBcb1Ma7SPiCxV67W8Zsmopg\":\"0.09008146\",\"mkPcw4jWhPeVFjNYAeF6Wqxh7RyT65CcoP\":\"0.09008146\",\"mj9ntDNp5NofdzHFGHL6RFuuTVC43oC1SC\":\"0.09008146\",\"msueoXhZN6hn3CHWfjLNM1PfeKfLFfScDX\":\"0.09008146\"}"
01000000000e36748900000000001976a91433cf5ed7fb909da7e5fcbb74a3d1f3538ed9310688ac36748900000000001976a914d76442de664bfa38ff65214ca2f75c32b8d8e79e88ac36748900000000001976a9144734c89ce95623eedba1daa56194f6e6c8778ea188ac36748900000000001976a9148ebdaf88c8ada5338744f849d9b3f79956fcdc5088ac36748900000000001976a914949d28c6c445285686c97af04213b2401c172ec688ac36748900000000001976a9142cf3e448a79017173172b182065c4d043d5bc14988ac36748900000000001976a914215e803eebf87241c580454f29de33b3ec63f3ac88ac36748900000000001976a914d98d44aee3fec6ae748deebab298536a6b0bb33588ac36748900000000001976a914ec9819be93b2eb2f3bd5c90fffb659b0022f9d7788ac12748900000000001976a9147ab09ec3a885cecf92d9db2abba047d5b499188a88ac12748900000000001976a914946f512fb9763ae4630462e003eaecf6ad58b4ac88ac12748900000000001976a91435758e013190510455e3a6bbc7b2985ce93e36d188ac12748900000000001976a91427dfe97919dda4e3aeb43eb46d20a751f092fd5488ac12748900000000001976a91487ec79a116b912e6b8c9da946978151a97ed0a5f88ac00000000

$ ./litecoin-cli fundrawtransaction "01000000000e36748900000000001976a91433cf5ed7fb909da7e5fcbb74a3d1f3538ed9310688ac36748900000000001976a914d76442de664bfa38ff65214ca2f75c32b8d8e79e88ac36748900000000001976a9144734c89ce95623eedba1daa56194f6e6c8778ea188ac36748900000000001976a9148ebdaf88c8ada5338744f849d9b3f79956fcdc5088ac36748900000000001976a914949d28c6c445285686c97af04213b2401c172ec688ac36748900000000001976a9142cf3e448a79017173172b182065c4d043d5bc14988ac36748900000000001976a914215e803eebf87241c580454f29de33b3ec63f3ac88ac36748900000000001976a914d98d44aee3fec6ae748deebab298536a6b0bb33588ac36748900000000001976a914ec9819be93b2eb2f3bd5c90fffb659b0022f9d7788ac12748900000000001976a9147ab09ec3a885cecf92d9db2abba047d5b499188a88ac12748900000000001976a914946f512fb9763ae4630462e003eaecf6ad58b4ac88ac12748900000000001976a91435758e013190510455e3a6bbc7b2985ce93e36d188ac12748900000000001976a91427dfe97919dda4e3aeb43eb46d20a751f092fd5488ac12748900000000001976a91487ec79a116b912e6b8c9da946978151a97ed0a5f88ac00000000" "{\"changeAddress\":\"mvMqabxd8eq3hZBem9oy8E29sk6HQSZaRZ\",\"feeRate\":0.0001}"
error code: -32603
error message:
Transaction too large for fee policy

$ ./litecoin-cli fundrawtransaction "01000000000e36748900000000001976a91433cf5ed7fb909da7e5fcbb74a3d1f3538ed9310688ac36748900000000001976a914d76442de664bfa38ff65214ca2f75c32b8d8e79e88ac36748900000000001976a9144734c89ce95623eedba1daa56194f6e6c8778ea188ac36748900000000001976a9148ebdaf88c8ada5338744f849d9b3f79956fcdc5088ac36748900000000001976a914949d28c6c445285686c97af04213b2401c172ec688ac36748900000000001976a9142cf3e448a79017173172b182065c4d043d5bc14988ac36748900000000001976a914215e803eebf87241c580454f29de33b3ec63f3ac88ac36748900000000001976a914d98d44aee3fec6ae748deebab298536a6b0bb33588ac36748900000000001976a914ec9819be93b2eb2f3bd5c90fffb659b0022f9d7788ac12748900000000001976a9147ab09ec3a885cecf92d9db2abba047d5b499188a88ac12748900000000001976a914946f512fb9763ae4630462e003eaecf6ad58b4ac88ac12748900000000001976a91435758e013190510455e3a6bbc7b2985ce93e36d188ac12748900000000001976a91427dfe97919dda4e3aeb43eb46d20a751f092fd5488ac12748900000000001976a91487ec79a116b912e6b8c9da946978151a97ed0a5f88ac00000000" "{\"changeAddress\":\"mvMqabxd8eq3hZBem9oy8E29sk6HQSZaRZ\",\"feeRate\":0.0009}"
error code: -32603
error message:
Transaction too large for fee policy

$ ./litecoin-cli fundrawtransaction "01000000000e36748900000000001976a91433cf5ed7fb909da7e5fcbb74a3d1f3538ed9310688ac36748900000000001976a914d76442de664bfa38ff65214ca2f75c32b8d8e79e88ac36748900000000001976a9144734c89ce95623eedba1daa56194f6e6c8778ea188ac36748900000000001976a9148ebdaf88c8ada5338744f849d9b3f79956fcdc5088ac36748900000000001976a914949d28c6c445285686c97af04213b2401c172ec688ac36748900000000001976a9142cf3e448a79017173172b182065c4d043d5bc14988ac36748900000000001976a914215e803eebf87241c580454f29de33b3ec63f3ac88ac36748900000000001976a914d98d44aee3fec6ae748deebab298536a6b0bb33588ac36748900000000001976a914ec9819be93b2eb2f3bd5c90fffb659b0022f9d7788ac12748900000000001976a9147ab09ec3a885cecf92d9db2abba047d5b499188a88ac12748900000000001976a914946f512fb9763ae4630462e003eaecf6ad58b4ac88ac12748900000000001976a91435758e013190510455e3a6bbc7b2985ce93e36d188ac12748900000000001976a91427dfe97919dda4e3aeb43eb46d20a751f092fd5488ac12748900000000001976a91487ec79a116b912e6b8c9da946978151a97ed0a5f88ac00000000" "{\"changeAddress\":\"mvMqabxd8eq3hZBem9oy8E29sk6HQSZaRZ\",\"feeRate\":0.001}"
{
  "hex": "010000000153964a7aaacd6b3c52d6460a65ebda19233043c5e467a126d3ec2b580a7100bc0100000000feffffff0f36748900000000001976a91433cf5ed7fb909da7e5fcbb74a3d1f3538ed9310688ac36748900000000001976a914d76442de664bfa38ff65214ca2f75c32b8d8e79e88ac36748900000000001976a9144734c89ce95623eedba1daa56194f6e6c8778ea188ac36748900000000001976a9148ebdaf88c8ada5338744f849d9b3f79956fcdc5088ac36748900000000001976a914949d28c6c445285686c97af04213b2401c172ec688ac36748900000000001976a9142cf3e448a79017173172b182065c4d043d5bc14988ac36748900000000001976a914215e803eebf87241c580454f29de33b3ec63f3ac88ac36748900000000001976a914d98d44aee3fec6ae748deebab298536a6b0bb33588ac36748900000000001976a914ec9819be93b2eb2f3bd5c90fffb659b0022f9d7788ac12748900000000001976a9147ab09ec3a885cecf92d9db2abba047d5b499188a88ac12748900000000001976a914946f512fb9763ae4630462e003eaecf6ad58b4ac88acd2391307000000001976a914a2d089b930ce1f6f03af22bce5a1bc5d542aada288ac12748900000000001976a91435758e013190510455e3a6bbc7b2985ce93e36d188ac12748900000000001976a91427dfe97919dda4e3aeb43eb46d20a751f092fd5488ac12748900000000001976a91487ec79a116b912e6b8c9da946978151a97ed0a5f88ac00000000",
  "changepos": 11,
  "fee": 0.00066800
}

If I omit feeRate it gives the same estimate fee "fee": 0.00066800 as for feeRate: 0.001.

Is there any explanation about this behavior ?

EDIT: in bitcoin it works just fine if I specify feeRate: 0.0001, so it has to be something to do with litecoin.

For now, as a workaround, I'm just omitting feeRate in fundrawtransaction() completely..

Thank you.

@Someguy123
Copy link

The fee in LTC is 0.001 LTC per kb, it's mandatory. You can't lower that fee on LTC, and there are special rules for dust (outputs under 0.001 LTC) which cause penalty TX fees (addt. 0.001 LTC per 0.001< output).

@gituser
Copy link
Author

gituser commented Apr 19, 2017

@Someguy123, how can you explain then that the resulting fee is 0.00066800 LTC per 1024bytes transaction? Which is less than 0.001 LTC...

@face
Copy link

face commented Apr 21, 2017

I think 0.00066800 is the fee for the entire transaction, not per 1024 bytes. So, if the entire transaction is < 1024 bytes, than a fraction of the .001 fee per 1024 bytes make sense. I tried to find your transaction in a testnet block explorer, but couldn't find it to verify the complete transaction size.

@gituser
Copy link
Author

gituser commented Apr 21, 2017

@face, sure it is.

It's just confusing what feeRate actually means?

@face
Copy link

face commented Apr 21, 2017

feeRate = fee per 1024 bytes. You ask how the "fee" it can be less than .001 and that confuses you. That is because it is the "fee" that is .000668, not the "feeRate".

I think it will make more sense to you if you compare it to a rate in a grocery store. So instead of .001 per 1024 bytes, say it was $1 per kilogram of rice. If you then bought half a kilogram of rice, the final fee would be $0.50. That is how a rate of $1 produces a fee of $0.50. The same thing with Litecoin. If you pay a rate of .001 per 1024bytes for 512 bytes, your fee would be .0005, which is less than the feeRate of .001.

@gituser
Copy link
Author

gituser commented Apr 21, 2017

@face

feeRate = fee per 1024 bytes. You ask how the "fee" it can be less than .001 and that confuses you. That is because it is the "fee" that is .000668, not the "feeRate".

Here you go, the test transaction: https://chain.so/tx/LTCTEST/1229e0f7be81971e9618b6ba66165d7f8b2dcf94fb1c48da31e579e072ad311e

It's 1212 bytes, final fee is 0.00121200 LTC

So fee per KB should be: 0,001024 LTC or so, right? Are you sure, btw, KB is 1024 bytes and not 1000 bytes?

But in fact I can't set feeRate to anything less than 0.001 LTC which seems very odd to me.

It seems the fee per KB was in fact used little over then 0.001 LTC, when in fact default is 0.0001 LTC

@face
Copy link

face commented Apr 21, 2017

Yes. But what is odd about a hard coded consensus rule to prevent spamming with dust? As @Someguy123 stated: "The fee in LTC is 0.001 LTC per kb, it's mandatory"

@gituser
Copy link
Author

gituser commented Apr 21, 2017

@face sorry i didn't know that multi output transaction requires 0.001 LTC per kb.
is there anything about his in the docs or somewhere? or it's just hardcoded in the code?

@face
Copy link

face commented Apr 22, 2017

Yes, it is documented as mintxfee. And it applies to single output transactions too. It applies to all transactions: https://litecoin.info/Transaction_fees

@gituser
Copy link
Author

gituser commented Apr 26, 2017

ok, @face, I'm closing this issue then.

would be nice tho for developers force this fee policy as well for settxfee aka paytxfee.

@gituser gituser closed this as completed Apr 26, 2017
AmazingDreams pushed a commit to Electronic-Gulden-Foundation/egulden that referenced this issue Sep 4, 2017
8225239 Merge litecoin-project#433: Make the libcrypto detection fail the newer API.
12de863 Make the libcrypto detection fail the newer API.
2928420 Merge litecoin-project#427: Remove Schnorr from travis as well
8eecc4a Remove Schnorr from travis as well
a8abae7 Merge litecoin-project#310: Add exhaustive test for group functions on a low-order subgroup
b4ceedf Add exhaustive test for verification
83836a9 Add exhaustive tests for group arithmetic, signing, and ecmult on a small group
20b8877 Add exhaustive test for group functions on a low-order subgroup
80773a6 Merge litecoin-project#425: Remove Schnorr experiment
e06e878 Remove Schnorr experiment
04c8ef3 Merge litecoin-project#407: Modify parameter order of internal functions to match API parameter order
6e06696 Merge litecoin-project#411: Remove guarantees about memcmp-ability
40c8d7e Merge litecoin-project#421: Update scalar_4x64_impl.h
a922365 Merge litecoin-project#422: Restructure nonce clearing
3769783 Restructure nonce clearing
0f9e69d Restructure nonce clearing
9d67afa Update scalar_4x64_impl.h
7d15cd7 Merge litecoin-project#413: fix auto-enabled static precompuatation
00c5d2e fix auto-enabled static precompuatation
91219a1 Remove guarantees about memcmp-ability
7a49cac Merge litecoin-project#410: Add string.h include to ecmult_impl
0bbd5d4 Add string.h include to ecmult_impl
353c1bf Fix secp256k1_ge_set_table_gej_var parameter order
541b783 Fix secp256k1_ge_set_all_gej_var parameter order
7d893f4 Fix secp256k1_fe_inv_all_var parameter order
c5b32e1 Merge litecoin-project#405: Make secp256k1_fe_sqrt constant time
926836a Make secp256k1_fe_sqrt constant time
e2a8e92 Merge litecoin-project#404: Replace 3M + 4S doubling formula with 2M + 5S one
8ec49d8 Add note about 2M + 5S doubling formula
5a91bd7 Merge litecoin-project#400: A couple minor cleanups
ac01378 build: add -DSECP256K1_BUILD to benchmark_internal build flags
a6c6f99 Remove a bunch of unused stdlib #includes
65285a6 Merge litecoin-project#403: configure: add flag to disable OpenSSL tests
a9b2a5d configure: add flag to disable OpenSSL tests
b340123 Merge litecoin-project#402: Add support for testing quadratic residues
e6e9805 Add function for testing quadratic residue field/group elements.
efd953a Add Jacobi symbol test via GMP
fa36a0d Merge litecoin-project#401: ecmult_const: unify endomorphism and non-endomorphism skew cases
c6191fd ecmult_const: unify endomorphism and non-endomorphism skew cases
0b3e618 Merge litecoin-project#378: .gitignore build-aux cleanup
6042217 Merge litecoin-project#384: JNI: align shared files copyright/comments to bitcoinj's
24ad20f Merge litecoin-project#399: build: verify that the native compiler works for static precomp
b3be852 Merge litecoin-project#398: Test whether ECDH and Schnorr are enabled for JNI
aa0b1fd build: verify that the native compiler works for static precomp
eee808d Test whether ECDH and Schnorr are enabled for JNI
7b0fb18 Merge litecoin-project#366: ARM assembly implementation of field_10x26 inner (rebase of litecoin-project#173)
001f176 ARM assembly implementation of field_10x26 inner
0172be9 Merge litecoin-project#397: Small fixes for sha256
3f8b78e Fix undefs in hash_impl.h
2ab4695 Fix state size in sha256 struct
6875b01 Merge litecoin-project#386: Add some missing `VERIFY_CHECK(ctx != NULL)`
2c52b5d Merge litecoin-project#389: Cast pointers through uintptr_t under JNI
43097a4 Merge litecoin-project#390: Update bitcoin-core GitHub links
31c9c12 Merge litecoin-project#391: JNI: Only call ecdsa_verify if its inputs parsed correctly
1cb2302 Merge litecoin-project#392: Add testcase which hits additional branch in secp256k1_scalar_sqr
d2ee340 Merge litecoin-project#388: bench_ecdh: fix call to secp256k1_context_create
093a497 Add testcase which hits additional branch in secp256k1_scalar_sqr
a40c701 JNI: Only call ecdsa_verify if its inputs parsed correctly
faa2a11 Update bitcoin-core GitHub links
47b9e78 Cast pointers through uintptr_t under JNI
f36f9c6 bench_ecdh: fix call to secp256k1_context_create
bcc4881 Add some missing `VERIFY_CHECK(ctx != NULL)` for functions that use `ARG_CHECK`
6ceea2c align shared files copyright/comments to bitcoinj's
70141a8 Update .gitignore
7b549b1 Merge litecoin-project#373: build: fix x86_64 asm detection for some compilers
bc7c93c Merge litecoin-project#374: Add note about y=0 being possible on one of the sextic twists
e457018 Merge litecoin-project#364: JNI rebased
86e2d07 JNI library: cleanup, removed unimplemented code
3093576 JNI library
bd2895f Merge pull request litecoin-project#371
e72e93a Add note about y=0 being possible on one of the sextic twists
3f8fdfb build: fix x86_64 asm detection for some compilers
e5a9047 [Trivial] Remove double semicolons
c18b869 Merge pull request litecoin-project#360
3026daa Merge pull request litecoin-project#302
03d4611 Add sage verification script for the group laws
a965937 Merge pull request litecoin-project#361
83221ec Add experimental features to configure
5d4c5a3 Prevent damage_array in the signature test from going out of bounds.
419bf7f Merge pull request litecoin-project#356
03d84a4 Benchmark against OpenSSL verification

git-subtree-dir: src/secp256k1
git-subtree-split: 8225239
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants