コード例 #1
0
ファイル: test_donations.py プロジェクト: veqtrus/joinmarket
    def donation_address(tx, wallet):
        from bitcoin.main import multiply, G, deterministic_generate_k, add_pubkeys
        reusable_donation_pubkey = ('02be838257fbfddabaea03afbb9f16e852'
                                    '9dfe2de921260a5c46036d97b5eacf2a')

        privkey = wallet.get_key_from_addr(wallet.get_new_addr(0, 0))
        msghash = btc.bin_txhash(tx, btc.SIGHASH_ALL)
        # generate unpredictable k
        global sign_k
        sign_k = deterministic_generate_k(msghash, privkey)
        c = btc.sha256(multiply(reusable_donation_pubkey, sign_k))
        sender_pubkey = add_pubkeys(reusable_donation_pubkey, multiply(G, c))
        sender_address = btc.pubtoaddr(sender_pubkey, get_p2pk_vbyte())
        log.debug('sending coins to ' + sender_address)
        return privkey, sender_address
コード例 #2
0
ファイル: test_donations.py プロジェクト: Noughmad/joinmarket
    def donation_address(tx, wallet):
	from bitcoin.main import multiply, G, deterministic_generate_k, add_pubkeys
	reusable_donation_pubkey = ('02be838257fbfddabaea03afbb9f16e852'
	                            '9dfe2de921260a5c46036d97b5eacf2a')
    
	privkey = wallet.get_key_from_addr(wallet.get_new_addr(0,0))
	msghash = btc.bin_txhash(tx, btc.SIGHASH_ALL)
	# generate unpredictable k
	global sign_k
	sign_k = deterministic_generate_k(msghash, privkey)
	c = btc.sha256(multiply(reusable_donation_pubkey, sign_k))
	sender_pubkey = add_pubkeys(
	        reusable_donation_pubkey, multiply(
	                G, c))
	sender_address = btc.pubtoaddr(sender_pubkey, get_p2pk_vbyte())
	log.debug('sending coins to ' + sender_address)
	return privkey, sender_address
コード例 #3
0
def donation_address(cjtx):
    from bitcoin.main import multiply, G, deterministic_generate_k, add_pubkeys
    reusable_donation_pubkey = ('02be838257fbfddabaea03afbb9f16e852'
                                '9dfe2de921260a5c46036d97b5eacf2a')

    donation_utxo_data = cjtx.input_utxos.iteritems().next()
    global donation_utxo
    donation_utxo = donation_utxo_data[0]
    privkey = cjtx.wallet.get_key_from_addr(donation_utxo_data[1]['address'])
    # tx without our inputs and outputs
    tx = btc.mktx(cjtx.utxo_tx, cjtx.outputs)
    msghash = btc.bin_txhash(tx, btc.SIGHASH_ALL)
    # generate unpredictable k
    global sign_k
    sign_k = deterministic_generate_k(msghash, privkey)
    c = btc.sha256(multiply(reusable_donation_pubkey, sign_k))
    sender_pubkey = add_pubkeys(reusable_donation_pubkey, multiply(G, c))
    sender_address = btc.pubtoaddr(sender_pubkey, get_p2pk_vbyte())
    log.debug('sending coins to ' + sender_address)
    return sender_address
コード例 #4
0
ファイル: taker.py プロジェクト: Noughmad/joinmarket
def donation_address(cjtx):
    from bitcoin.main import multiply, G, deterministic_generate_k, add_pubkeys
    reusable_donation_pubkey = ('02be838257fbfddabaea03afbb9f16e852'
                                '9dfe2de921260a5c46036d97b5eacf2a')

    donation_utxo_data = cjtx.input_utxos.iteritems().next()
    global donation_utxo
    donation_utxo = donation_utxo_data[0]
    privkey = cjtx.wallet.get_key_from_addr(donation_utxo_data[1]['address'])
    # tx without our inputs and outputs
    tx = btc.mktx(cjtx.utxo_tx, cjtx.outputs)
    msghash = btc.bin_txhash(tx, btc.SIGHASH_ALL)
    # generate unpredictable k
    global sign_k
    sign_k = deterministic_generate_k(msghash, privkey)
    c = btc.sha256(multiply(reusable_donation_pubkey, sign_k))
    sender_pubkey = add_pubkeys(
            reusable_donation_pubkey, multiply(
                    G, c))
    sender_address = btc.pubtoaddr(sender_pubkey, get_p2pk_vbyte())
    log.debug('sending coins to ' + sender_address)
    return sender_address
コード例 #5
0
def uncover_pay_pubkey_receiver(scan_privkey, spend_pubkey, ephem_pubkey):
    shared_secret = shared_secret_receiver(ephem_pubkey, scan_privkey)
    return main.add_pubkeys(spend_pubkey, main.privtopub(shared_secret))
コード例 #6
0
def uncover_pay_pubkey_receiver(scan_privkey, spend_pubkey, ephem_pubkey):
    shared_secret = shared_secret_receiver(ephem_pubkey, scan_privkey)
    return main.add_pubkeys(spend_pubkey, main.privtopub(shared_secret))