(translated with Yandex -
http://translate.yandex.ru/)
There is a need in one payment to stretch on many addresses with different weight ratios
now you have to use third party services - if part and large lists
what if in the client to create this opportunity?
do the so-called shared address - in which is recorded the address list with weighting factors:
shadrr_list = { "addr1": 2, "addr2": 0.33, ... }
for this make in API:
# create and save in wallet.dat list, so to change this list could
shaddr = makesharedaddress( shaddr_list, label )
# moreover creates an address on 1 character longer with the addition of 'S':
shaddr --> 'S1NilT.....13Gfas'
len(shaddr ) --> 35
To send all divided payments call the API command:
sendshared( shaddr, amount )
the body of the function (send divided payments) about this
################## on python
def sendshared( shaddr, amount ):
# calc sum
sum = 0.0
for v in shaddrs:
sum += v
# recalc amo_outs
list_out = {}
for (k, v) in shaddrs.iteritems():
list_out[k] = round(amount *v / sum, 8)
sum_out = 0.0
for v in list_out:
sum_out += v
diff = sum - sum_out
# and to stretch the difference between 0.00000001 accidentally addresses
while diff>0:
diff -= 0.00000001
list_out[random_key[list_out]] += 0.00000001
return connection.sendmany(list_out)
#################
origin:
https://bitcointalk.org/index.php?topic=807172.msg9049742