How do I send a Bitcoin address from an iPhone to my server?
Basic Python client socket example:
Server side:
import socket
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(('localhost', 8089))
serversocket.listen(5) # become a server socket, maximum 5 connections
while True:
connection, address = serversocket.accept()
buf = connection.recv(64)
if len(buf) > 0:
print buf
break
Client Side:
import socket
clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientsocket.connect(('localhost', 8089))
clientsocket.send('hello')
How do I make a Bitcoin transaction using Python from my server?
How to make a simple payment with the python-bitcoinlib?
(Rewritten for brevity)
Run
bitcoind,
install python-bitcoinlib, then run this code:
from bitcoin.core import COIN, b2lx
from bitcoin.base58 import CBitcoinAddress
import bitcoin.wallet
import bitcoin.rpc
rpc = bitcoin.rpc.Proxy()
addr = CBitcoinAddress('1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T')
txid = rpc.sendtoaddress(addr, 0.001 * COIN)
print(b2lx(txid))