I'm trying to check to see if the variables are being set correctly by the client and being received correctly by me. I'm new to proto buffs and django and my code below doesn't seem to be working. I'm using bitcoin 0.9 I'm trying to capture a refund address.

In views:

from project import payments_pb2
def protoresponse(request):
    xpo = payments_pb2.Payment.ParseFromString(request)
    returnaddress = xpo.refund_to
    transactions = xpo.transactions
    memo = xpo.memo

    xpa = payments_pb2.PaymentACK
    xpa.payment = xpo.SerializeToString()
    xpa.memo = 'success'
    return HttpResponse(xpa.SerializeToString(), content_type="application/octet-stream")

Any pointers would be greatly appreciated :)

  • Any information how it doesn't work is necessary for answering the question. Jun 10, 2014 at 14:04
  • Thank you for the response :) I receive a 'forbidden access' error once I attempt to send the payment after initially opening the URI, (where to send the payment object is different to the initial URI address). Do I need to do something special to the object like def protoresponse(request, content_type="application/octet-stream")? Are there any obvious mistakes with the above code?
    – derrend
    Jun 10, 2014 at 22:26
  • Forbidden access is not related to the code above, but is most likely related to your web server. Please study how to setup a basic single web page through Django first, see it works and then try see that your protoresponse view gets called properly. Jun 11, 2014 at 7:52
  • It is unlikely the error is any way related to the code or the question above, unless shown otherwise. Jun 11, 2014 at 7:52
  • will the protobuffer object come through as a request that I must deserialize - edit - and reserialize before sending back? Please can you give me an example, I cannot find any documentation or forum posts specifically on this subject which is why I am posting here. Thanks :)
    – derrend
    Jun 11, 2014 at 9:46

1 Answer 1


I asked this same question in a simpler way without mentioning bip 70 and got the answer here.

The initial problem was that Django doesn't like people posting to your server who arent authorised so I used from django.views.decorators.csrf import csrf_exempt and the corresponding decorator @csrf_exempt as a short term work around for further debugging.

More detailed info can be found by following the link to the simplified question.

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.