Exemple #1
0
def privkey_import():
    from lib import import_privkey, gen_partial_tx, check_rcv_2of3, sign_rawtx, send_raw_tx
    privkey = request.form.get("privkey")
    try:
        output = import_privkey(conn, privkey) or ""
    except Exception as e:
        output = 'ERROR: %s, privkey=%s' % (e.error, privkey)
    import pickle
    f = open('/tmp/bliver.dat', 'r')
    [ms, amount] = pickle.load(f)
    print 'loaded: %s, %s' % (ms, amount)
    f.close()
    check = check_rcv_2of3(conn, ms, amount)
    output += '<br>check_rcv_2of3(%s, %s)</br>' % (ms, amount)
    if check and check[0]:
        _, txid, voutid = check
        partial_tx = gen_partial_tx(conn, TARGET_ADDR, txid, voutid, amount)
        output += '<br>gen_partial_tx(%s, %s, %s, %s)</br>' % (
            TARGET_ADDR, txid, voutid, amount)
        signed_tx = sign_rawtx(conn, partial_tx)
        output += '<br>sign_rawtx(%s)</br>' % partial_tx
        output += '<br>SIGNED AND SENT!<br>%s' % send_raw_tx(conn, signed_tx)
    else:
        output += '<br>check = FALSE :('
    return render_template('privkey.html', output=output)
Exemple #2
0
def gen_qr(pubkey, target_addr=TARGET_ADDR, amount=0.1):
    from lib import gen_partial_tx, check_rcv_2of3, sign_rawtx
    multisig = gen_multisig(pubkey)
    check = check_rcv_2of3(conn, multisig, amount)
    if check and check[0]:
        _, txid, voutid = check
        partial_tx = gen_partial_tx(conn, target_addr, txid, voutid, amount)
        signed_partial_tx = sign_rawtx(conn, partial_tx)
        data = signed_partial_tx.decode("hex").encode("base64")
        import urllib
        return '%s?data=%s' % (url_for('qr'), urllib.quote_plus(data))
    else:
        return 'check_rcv_2of3_failed'
Exemple #3
0
def gen_qr(pubkey, target_addr = TARGET_ADDR, amount = 0.1):
  from lib import gen_partial_tx, check_rcv_2of3, sign_rawtx
  multisig = gen_multisig(pubkey)
  check = check_rcv_2of3(conn, multisig, amount)
  if check and check[0]:
    _, txid, voutid = check
    partial_tx = gen_partial_tx(conn, target_addr, txid, voutid, amount)
    signed_partial_tx = sign_rawtx(conn, partial_tx)
    data = signed_partial_tx.decode("hex").encode("base64")
    import urllib
    return '%s?data=%s' % (url_for('qr'), urllib.quote_plus(data))
  else:
    return 'check_rcv_2of3_failed'
Exemple #4
0
def privkey_import():
  from lib import import_privkey, gen_partial_tx, check_rcv_2of3, sign_rawtx, send_raw_tx
  privkey = request.form.get("privkey")
  try:
    output = import_privkey(conn, privkey) or ""
  except Exception as e:
    output = 'ERROR: %s, privkey=%s' % (e.error, privkey)
  import pickle
  f = open('/tmp/bliver.dat','r')
  [ms, amount] = pickle.load(f)
  print 'loaded: %s, %s' % (ms, amount) 
  f.close()
  check = check_rcv_2of3(conn, ms, amount)
  output += '<br>check_rcv_2of3(%s, %s)</br>' % (ms, amount)
  if check and check[0]:
    _, txid, voutid = check
    partial_tx = gen_partial_tx(conn, TARGET_ADDR, txid, voutid, amount)
    output += '<br>gen_partial_tx(%s, %s, %s, %s)</br>' % (TARGET_ADDR, txid, voutid, amount)
    signed_tx = sign_rawtx(conn, partial_tx)
    output += '<br>sign_rawtx(%s)</br>' % partial_tx
    output += '<br>SIGNED AND SENT!<br>%s' % send_raw_tx(conn, signed_tx)
  else:
    output += '<br>check = FALSE :('
  return render_template('privkey.html', output = output)
Exemple #5
0
def check():
    addr = request.args.get('addr', '')
    from lib import check_rcv_2of3
    value = float(request.args.get('value', 0.0))
    c = check_rcv_2of3(conn, addr, value)
    return render_template('check.html', c=c, addr=addr)
Exemple #6
0
def check():
  addr = request.args.get('addr','')
  from lib import check_rcv_2of3
  value = float(request.args.get('value', 0.0))
  c = check_rcv_2of3(conn, addr, value)
  return render_template('check.html', c = c, addr = addr)