Background I just got started yesterday learning Python and I'm currently building my first iPhone game.

What I'm trying to do is create a Bitcoin Pot Jar inside an iPhone app like Sarutobi:https://itunes.apple.com/us/app/id932194840?mt=8

You can test out the game to see how it works. All the user does is paste their bitcoin address in an input field, somehow this data goes somewhere and then the user receives randomly small tip during gameplay. How do I create something like this? What code is used to make this work?

  • What is this?: client_pass = "dadfisasf#@$sdf3sfR"
    – bluebit
    Commented Jan 18, 2015 at 17:16
  • I think this may be off-topic because this is a general programming question that is better suited for stackexchange.com.
    – cdecker
    Commented Jan 18, 2015 at 17:43
  • 1
    I was sent here from stackexchange.com and now you're telling me to go back? stackoverflow.com/questions/28012008/…
    – bluebit
    Commented Jan 18, 2015 at 18:01
  • @cdecker While this is an incredibly broad question, its scope lies entirely within cryptocurrency. I've going to vote to leave open.
    – Nick ODell
    Commented Jan 18, 2015 at 20:02
  • @bluebit You should get more familiar with Web Services. Bassically iPhone will send request for invoking method to Web Service that lies on your server. Server will create and broadcast the transaction. - Sorry for previously misleading link.
    – Marek
    Commented Jan 18, 2015 at 20:17

1 Answer 1


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

Client Side:

import socket

clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientsocket.connect(('localhost', 8089))

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.