Bitcoin Forum
July 23, 2024, 08:35:24 AM *
News: Help 1Dq create 15th anniversary forum artwork.
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [idea] shared payments  (Read 859 times)
icreator (OP)
Legendary
*
Offline Offline

Activity: 1554
Merit: 1008



View Profile WWW
October 02, 2014, 04:17:51 AM
 #1

(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

Erachain Blockchain is fully ready for use Digital Ecosystem based on blockchain technology for business and government with low transaction costs, identification and built-in functions.
+Decentralized exchange of tokens in Erachain
seoincorporation
Legendary
*
Offline Offline

Activity: 3220
Merit: 3024



View Profile
October 02, 2014, 05:37:40 PM
 #2

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 ""

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
icreator (OP)
Legendary
*
Offline Offline

Activity: 1554
Merit: 1008



View Profile WWW
October 02, 2014, 06:20:43 PM
 #3

It may do any programmer  but not end user!

Erachain Blockchain is fully ready for use Digital Ecosystem based on blockchain technology for business and government with low transaction costs, identification and built-in functions.
+Decentralized exchange of tokens in Erachain
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!