Bitcoin Forum
November 19, 2024, 07:25:33 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin client RPC/json sendmany  (Read 955 times)
cloverme (OP)
Legendary
*
Offline Offline

Activity: 1512
Merit: 1057


SpacePirate.io


View Profile WWW
May 13, 2016, 03:10:40 AM
Merited by ABCbits (1)
 #1

I'd like to bundle some send transactions together programmatically to save on transaction fees.  It looks like the sendmany API call to via RPC will do this, but I have some questions if anyone has used this API call before. 

Is there an upward limit per sendmany transaction? 100, 255, 1000?

Any way to easily calculate the appropriate transaction fee for such a transaction?

Thanks in advance  Wink
belcher
Sr. Member
****
Offline Offline

Activity: 261
Merit: 523


View Profile
May 13, 2016, 12:08:47 PM
Merited by ABCbits (1)
 #2

The upper limit will be set by the maximum size of transactions in blocks. If you look at the transactions from some exchanges, you'll see some of them are quite large and seem to confirm without any problems.

I believe sendmany uses the wallet transaction fees settings to automatically work out how much it should pay in miner fees.

It's best to play with this stuff in testnet first, because you can then just try it and see without any danger of losing valuable coins or paying too much or too little in fees.

1HZBd22eQLgbwxjwbCtSjhoPFWxQg8rBd9
JoinMarket - CoinJoin that people will actually use.
PGP fingerprint: 0A8B 038F 5E10 CC27 89BF CFFF EF73 4EA6 77F3 1129
Patatas
Legendary
*
Offline Offline

Activity: 1750
Merit: 1115

Providing AI/ChatGpt Services - PM!


View Profile
May 13, 2016, 12:46:54 PM
Merited by ABCbits (2)
 #3

Is there an upward limit per sendmany transaction? 100, 255, 1000?
As far as I know,there is no limit as such but considering the transaction size and the related fees ,you probably have to set your own limits.Doesn't it depends on the block-size as well ? Clear me if I missed something there.

Any way to easily calculate the appropriate transaction fee for such a transaction?
To describe in detail ,check this :
Quote
9
down vote
accepted
See GetMinFee() in main.h for the code which determines the minimum transaction fee.

The part you're describing is implemented as follows:

// Raise the price as the block approaches full
if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)
{
    if (nNewBlockSize >= MAX_BLOCK_SIZE_GEN)
        return MAX_MONEY;
    nMinFee *= MAX_BLOCK_SIZE_GEN / (MAX_BLOCK_SIZE_GEN - nNewBlockSize);
}
where:

nBlockSize depends on who we are:
if we're a user making a new transaction, nBlockSize is 1
if we're a node deciding whether to relay an incoming transaction, nBlockSize is 1000
if we're a miner deciding which transactions to include in a new block, nBlockSize is the size of the block we're building before adding the new transaction
nNewBlockSize is the size of the block including the new transaction
MAX_BLOCK_SIZE_GEN is 500kB
MAX_MONEY is 21 million BTC (all the money in the world)
so it's saying:

if we're either deciding whether to relay or mine the transaction, and adding the transaction would make the block over 50% full:
never allow a transaction that makes the block 100% full
otherwise scale the fee up by a factor of 500kB / (500kB - nNewBlockSize)
Note: by rearranging the symbols, we get exactly what Meni wrote in his answer:

Fee = Normal fee / ((500kB - size) / 500kB) = Normal fee / (1 - size / 500kB)

Source : http://bitcoin.stackexchange.com/questions/3400/what-is-the-exact-formula-for-calculating-transaction-fees

The easy way could be taking the size of the transaction into consideration and assuming standard fee of 0.0001kb,you can do the math.
cloverme (OP)
Legendary
*
Offline Offline

Activity: 1512
Merit: 1057


SpacePirate.io


View Profile WWW
May 13, 2016, 04:17:23 PM
 #4

Thanks... Good ideas and information here.  Cool

Yeah, I was planning on testing the functionality on testnet beforehand, I think I got enuff testnet coins to play with lol
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!