Git Product home page Git Product logo

django-blockchain's Introduction

django-blockchain

Wrap the Blockchain API in Django!

What's implemented

Accually is not much. The receive API.

Caveat

You must implement your own version of ReceiveNotification! The reason is simply that you may have varying needs for how to store things like the original JSON (See django-psqljsonb) or custom fields.

Creating the class is simple

from django_blockchain.models import ReceiveNotificationBase

class ReceiveNotification(ReceiveNotificationBase):
    """Fine with the defaults, thanks"""
    pass

Store the dotted path in settings

BLOCKCHAIN_RECEIVE_NOTIFICATION_MODEL = 'yourapp.models.ReceiveNotification'

Installation

INSTALLED_APPS = (
    'django_blockchain',
)

And something in your urls.py

urlpatterns = patterns('',
    url(r'^receive_notification$', 'django_blockchain.views.receive_notification', name='receive_notification'),
)

Configuration

The following settings are optional

  • BLOCKCHAIN_API_KEY
  • BLOCKCHAIN_DESTINATION_ADDRESS

For receiving, you may want to configure these

  • BLOCKCHAIN_RECEIVE_API_ENDPOINT
  • BLOCKCHAIN_RECEIVE_NOTIFICATION_MODEL

This one is required if you use django_blockchain.views.receive_notification

  • BLOCKCHAIN_RECEIVE_CONFIRMATION_LIMIT

Usage

To create a new receiving address:

res = models.ReceiveResponse.receive(YOUR_ADDRESS, YOUR_CALLBACK_URL)

or if you configured BLOCKCHAIN_DESTINATION_ADDRESS and BLOCKCHAIN_RECEIVE_API_ENDPOINT:

res = models.ReceiveResponse.receive()

For receiving notifications, make sure your urls.py has something like this:

urlpatterns = urlpatterns('',
    url(r'^receive_notification', 'django_blockchain.views.receive_notification', name='receive_notification')
)

django-blockchain's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.