Skip to main content

BCMR or Bitcoin Cash Metadata Registry is a Django app for storing, accessing and managing CashToken BCMR.

Quick start (development)

  1. Add the following to your requirements.txt:

    Pillow==9.4.0
    django-bcmr==x.x.x
  2. Add “bcmr” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'bcmr',
    ]
  3. Include the bcmr URLconf in your project urls.py like this:

    from django.conf.urls.static import static
    from django.conf import settings
    
    urlpatterns = [
        ...
        path('bcmr/', include('bcmr.urls')),
        ...
    ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  4. Add media and DRF (to restrict public access on root API auth token filter) config on settings.py:

    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
    
    REST_FRAMEWORK = {
        ...
        'DEFAULT_RENDERER_CLASSES': [
            'rest_framework.renderers.JSONRenderer'
        ]
    }
  5. Start the development server and visit http://localhost:8000/admin/ to access the DB (you’ll need the Admin app enabled).

  6. Visit http://localhost:8000/bcmr/ to check API endpoints for the BCMR and tokens.

Additional steps for deployment

  1. Add media and API location paths on nginx configuration file:

    location /media {
        proxy_pass http://127.0.0.1:<YOUR_DESIRED_MEDIA_PORT_HERE>;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $server_name;
    }
    
    location /bcmr {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }
  2. Add <YOUR_DESIRED_MEDIA_PORT_HERE> to your yml file:

    ports:
      ...
      - "<YOUR_DESIRED_MEDIA_PORT_HERE>:<YOUR_DESIRED_MEDIA_PORT_HERE>"
  3. Run simple http server hosting for media files using supervisor. Add to supervisord.conf:

    [program:media_server]
    command=python -m http.server <YOUR_DESIRED_MEDIA_PORT_HERE>
    autorestart=true
    stdout_logfile=/dev/stdout
    stdout_logfile_maxbytes=0
    stderr_logfile=/dev/stderr
    stderr_logfile_maxbytes=0
    stopasgroup=true

REST API

Check docs on http://localhost:8000/api/docs/

Tokens created by a user can only be modified/deleted by that user (owner).

All endpoints are restricted on its usage for prevention of users tampering other user’s tokens. An auth token generated upon creation of either a token helps impose this restriction. This token is used as a header for identification if the user modifying token data is the owner. Header name is Bcmr-Auth.

The endpoints are restricted as follows:

GET = no header required
POST = if header is supplied, created token/registry will belong to that auth token owner
     = if header is not supplied, a new auth token will be generated (new owner)
PUT/PATCH = header required
DELETE = header required

Main BCMR

Fetch at http://localhost:8000/bcmr/registries/main/

Only the admin can add/remove tokens in the BCMR. After adding tokens, ask permission from the admin to include your token to the BCMR.

Release files for django-bcmr 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-bcmr 0.1.9
File Size Uploaded
django-bcmr-0.1.9.tar.gz 16.1 kB Details

Release files / django-bcmr-0.1.9.tar.gz

Download URL django-bcmr-0.1.9.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3ecbe8fc2ccbbc8a91e71d992c3864009d11ec075c0b76ffe79c7e385ec259e6
BLAKE2b-256 checksum
How to use checksums
2188b5da39c547c30bc5829cac44851ac1862b5db2dac9292d20ccc0feaafaa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.17

Release history Release notifications | RSS feed

This release

0.1.9 This release

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page