def pre_save_wallet(sender, **kwargs): wallet = kwargs['instance'] if wallet.address == "": print 'generating address' print BITCOIN_CONNECTION_OPTS con = bitcoin.connect_to_remote(**BITCOIN_CONNECTION_OPTS) wallet.address = con.getnewaddress()
def get_node_connect(): """Получить коннект к ВТС ноде на основе constance.config""" login = config.NODE_LOGIN password = config.NODE_PASSWORD host = config.NODE_IP port = config.NODE_PORT conn = bitcoin.connect_to_remote(login, password, host, port) return conn
def reload_connection(user=None, password=None, host=None, port=None): global connection s = Settings.get_settings() s.BITCOIN_USER = user or getattr(s, "BITCOIN_USER", None) or BITCOIN_USER s.BITCOIN_PASS = password or getattr(s, "BITCOIN_PASS", None) or BITCOIN_PASS s.BITCOIN_HOST = host or getattr(s, "BITCOIN_HOST", None) or BITCOIN_HOST s.BITCOIN_PORT = port or getattr(s, "BITCOIN_PORT", None) or BITCOIN_PORT s.put() connection = bitcoin.connect_to_remote( s.BITCOIN_USER, s.BITCOIN_PASS, s.BITCOIN_HOST, port=s.BITCOIN_PORT, ) print connection.proxy._ServiceProxy__serviceURL
import web, os, re, json, string, urllib import pprint import bitcoin from btcdjson import BitcoindJson from sqlite3 import dbapi2 as sqlite btcd = bitcoin.connect_to_remote('eli', 'isthemaster') urls = ( '/', 'main', '/api/(.*)', 'API', '/tests', 'testingInterface' ) btcJson = BitcoindJson('eli', 'isthemaster') db = sqlite.connect('main.db') dbc = db.cursor() render = web.template.render('templates/') class API: def GET(self, action = None): request = web.input() result = btcJson(action, web.input()) return result
import bitcoin import settings connection = bitcoin.connect_to_remote( settings.BITCOIN_USER, settings.BITCOIN_PASS, settings.BITCOIN_HOST, port=8332, )
import bitcoin import time import sys import shelve from bitcoin.exceptions import InsufficientFunds import os conn = bitcoin.connect_to_remote('user', 'user123', host='127.0.0.1', port=19001) #if additional payment option is checked. Call it if cant collect with unspent without change > 0.0009. # If option disabled and change more this money can be frozen for long time befor buyer/merchant don't accept or you don't cancel. def additionalpaymentbuyer(fullamount): new = conn.getnewaddress() conn.sendtoaddress(new, fullamount) list = conn.listunspent(0) elem = -1 for el in list: if el["address"] == new: elem = list.index(el) break if elem ==-1: time.sleep(5) list = conn.listunspent(0) elem = -1 for el in list: if el["address"] == fraddress: elem = list.index(el) break if elem ==-1: time.sleep(10) list = conn.listunspent(0)
import bitcoin import time import sys import shelve from bitcoin.exceptions import InsufficientFunds import os conn = bitcoin.connect_to_remote('user', 'user123', host='127.0.0.1', port=19001) #if additional payment option is checked. Call it if cant collect with unspent without change > 0.0009. # If option disabled and change more this money can be frozen for long time befor buyer/merchant don't accept or you don't cancel. def additionalpaymentbuyer(fullamount): new = conn.getnewaddress() conn.sendtoaddress(new, fullamount) list = conn.listunspent(0) elem = -1 for el in list: if el["address"] == new: elem = list.index(el) break if elem == -1: time.sleep(5) list = conn.listunspent(0) elem = -1 for el in list: if el["address"] == fraddress: elem = list.index(el) break