Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: icreator on October 02, 2014, 04:17:51 AM



Title: [idea] shared payments
Post by: icreator on October 02, 2014, 04:17:51 AM
(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:

Code:
shadrr_list = { "addr1": 2, "addr2": 0.33, ... }

for this make in API:
Code:
# 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:
Code:
sendshared( shaddr, amount )

the body of the function (send divided payments) about this
Code:
################## 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


Title: Re: [idea] shared payments
Post by: seoincorporation on October 02, 2014, 05:37:40 PM
I have a bash script for this, it works with curl and Blockchain API

Code:
#!/bin/bash
#Guid
gu="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
#Blockchain password
pas="xxxxxxxxxx"
green="1LuckyG4tMMZf64j6ea7JhCz7sDpk6vdcS"
yellow="1LuckyY9fRzcJre7aou7ZhWVXktxjjBb9S"
red="1LuckyR1fFHEsXYyx5QK4UFzv3PEAepPMK"
BTCg="250000"
BTCy="150000"
BTCr="100000"
echo ""
curl "https://blockchain.info/merchant/$gu/sendmany?password=$pas&recipients=%7B%22$green%22%3A$BTCg%2C%22$yellow%22%3A$BTCy%2C%22$red%22%3A$BTCr%7D&shared=false&fee=10000"
echo ""


Title: Re: [idea] shared payments
Post by: icreator on October 02, 2014, 06:20:43 PM
It may do any programmer  but not end user!