• Stars
    star
    118
  • Rank 290,443 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A JavaScript library for making easy bitcoin payments, sending bitcoins and presenting bitcoin addresses on any HTML page.

Introduction

bitcoinaddress.js is a a JavaScript component library for making easy bitcoin payments, sending bitcoins and presenting bitcoin addresses on HTML pages.

image

Features

  • Mobile and touch friendly - no pop-ups
  • Use Bitcoin URI protocol to make payments from your desktop, web or mobile bitcoin wallet
  • Generate QR codes in-fly with JavaScript to make payments from mobile applications
  • Copy Bitcoin address to the clipboard
  • Customize and extend easily with custom DOM templates and JavaScript hooks

Demos

See the demo.

Installation

No server-side components needed.

You must have jQuery (version 1.9 or later) installed.

Drop bitcoinaddress.js on your HTML page with optio elements as described below. Download minified or debug bundle from Github dist folder The bundle includes QRCode.js library (see below).

How it works

  • Include bitcoinaddress.js on your HTML page
  • Configure and initialize it with a <script> tag
  • Supply a client-side template in a hidden on your page
  • When the HTML page has been loaded, bitcoinaddress.init() scans for .bitcoin-address CSS classes, applies template on them and sets up UI event handlers

Setting up <script> tag:

<script src="bitcoinaddress-bundle.min.js"></script>
<script>
    $(document).ready(function() {
        bitcoinaddress.init({

            // jQuery selector defining bitcon addresses on the page
            // needing the boost
            selector: ".bitcoin-address",

            // Id of the DOM template element we use to decorate the addresses.
            // This must contain placefolder .bitcoin-address
            template: "bitcoin-address-template",

            // Passed directly to QRCode.js
            // https://github.com/davidshimjs/qrcodejs
            qr : {
                width: 128,
                height: 128,
                colorDark : "#000000",
                colorLight : "#ffffff"
            },

            // By default the generated QR code is bitcoin:// URL.
            // However you might want to change this for altcoins, which do not have
            // official protocol handlers. Set true to remove bitcoin:// from
            // QR code.
            qrRawAddress: false
        });
    });
</script>

A DOM templating is used to built the controls for the Bitcoin addresses. Embed the following snippet hidden in and customize for your needs. See index.html for example CSS styles:

<div id="bitcoin-address-template" class="bitcoin-address-container" style="display: none">

    <div>
        <span class="bitcoin-address"></span>
    </div>

    <a href="#" class="bitcoin-address-action bitcoin-address-action-send">
        <i class="fa fa-btc"></i>
        Pay from wallet
    </a>

    <a href="#" class="bitcoin-address-action bitcoin-address-action-copy">
        <i class="fa fa-copy"></i>
        Copy
    </a>

    <a href="#" class="bitcoin-address-action bitcoin-address-action-qr">
        <i class="fa fa-qrcode"></i>
        QR code
    </a>

    <div class="bitcoin-action-hint bitcoin-action-hint-send">
        Sending payment to the address from locally installed Bitcoin wallet app.
    </div>

    <div class="bitcoin-action-hint bitcoin-action-hint-copy">
        Press CTRL + C or &#x2318; + C to copy the Bitcoin address.
    </div>

    <div class="bitcoin-action-hint bitcoin-action-hint-qr">
        <p>
            Scan the QR code with your mobile Bitcoin app to
            make the payment:
        </p>

        <div class="bitcoin-address-qr-container">
            <!-- Filled in by JS on action click -->
        </div>
    </div>

</div>

Then you can have Bitcoin addresses on your page, with or without payment amounts.

Plain Bitcoin address example:

<strong class="bitcoin-address" data-bc-address="19356KxTs9Bw5AAdxens5hoxDSp5bsUKse">19356KxTs9Bw5AAdxens5hoxDSp5bsUKse</strong>

Bitcoin address with payment amount example:

<strong class="bitcoin-address"
    data-bc-amount="0.1"
    data-bc-label="bitcoinaddress.js project"
    data-bc-message="0.1 BTC donation"
    data-bc-address="19356KxTs9Bw5AAdxens5hoxDSp5bsUKse">19356KxTs9Bw5AAdxens5hoxDSp5bsUKse</strong>

See the demo how to nominate the payment in the fiat currency using bitcoinprices.js library.

Supported data attributes

The following HTML5 data attributes are supported on .bitcoin-address elements

  • data-bc-address - bitcoin address for programmatical manipulation, required
  • data-bc-amount - suggestion how much to send
  • data-bc-label - address label in the wallet
  • data-bc-message - transaction message

NPM packaging

This project is also packaged and distributed on npmjs.org.

You can install the package with browserify and various other tools to include it in app JavaScript stack.

Other

See also bitcoin-prices.js JavaScript project for presenting Bitcoin prices in human-friendly manner and alternative currencies like USD and EUR.

Bitcoin URL scheme explained.

Bitcoin URIs in Electrum.

QRCode.js - generate QR codes in JavaScript by Shim Sangmin.

Development

NPM + Node required. A Makefile provides many commands to develop, test and publish this project.

browserify used for client-side module imports.

Install dependencies locally:

make setup

Run the development server with auto-reload (save bitcoinaddress.js in your text editor and the browser will reload index.html):

make dev-server

Run unit tests locally:

make test-server

Make a release:

make publish

Internals and the development toolchain

This package uses NPM, browserify for JavaScript dependencies, beefy development server, uglify-fs JavaScript minimizer.

tape unit testing framework runs the tests on testling continuous integration service infrastructure.

Check out Makefile if you want to learn how to use these tools.

Author

Mikko Ohtamaa (blog, Facebook, Twitter, Google+)

Contact for work and consulting offers.

More Repositories

1

python-Levenshtein

The Levenshtein Python C extension module contains functions for fast computation of Levenshtein distance and string similarity
C
378
star
2

ztanesh

Improve your UNIX command line experience and productivity with ztanesh project: the tools will make your shell more powerful and easier to use.
Shell
268
star
3

obfuscate.js

Obfuscate sensitive text on web pages for demostration screenshots
JavaScript
116
star
4

sublime-helper

sublime-helper is a shell script collection to setup Sublime Text configuration files and command line aliases based on predefined templates.
Shell
114
star
5

jquery-interdependencies

A Javascript library for dynamically showing and hiding HTML form fields based on rules and field interdependencies
JavaScript
105
star
6

bitcoin-prices

Display bitcoin prices in human-friendly manner in fiat currency using bitcoinaverage.com market data
JavaScript
99
star
7

detectmobile.js

detectmobile.js allows you detect mobile browsers, create intelligent mobile redirects in HTTP cache safe manner using Javascript.
JavaScript
68
star
8

Krusovice

Rhymic photo shows with HTML5 and <canvas>
JavaScript
52
star
9

pdf-to-html

PDF to JPEG images + HTML with <img> alt text converter
Python
48
star
10

desfire

MIFARE DESFire NFC communication protocol for Python
Python
39
star
11

vvv

VVV provides easy to integrate validation and linting tools to prevent bad stuff committed in your software project
Python
37
star
12

LibertyMusicStore

Bitcoin-based MP3 store which artists can add to their own websites
Python
33
star
13

aliens-vs-predator

Aliens vs. Predator Gold source code
C
29
star
14

objectpool.js

Object pool allocator for JavaScript
28
star
15

mfabrik.zoho

Zoho API integration for Python
Python
27
star
16

DRGNSRC

DOS version of Double Dragon II: The Revenge DRGNSRC dump
Assembly
20
star
17

django-nonrel-appengine-buildout

Buildout for creating django-nonrel applications on Google App engine
Python
13
star
18

sane_plone_addon_template

A sane Plone 4 add-on source code template
Python
12
star
19

tumblr-upload

Post a folder of images as Tumblr photo blog posts
Python
11
star
20

django-bitcoin-example

How to accept and spend bitcoins in your Django application
Python
11
star
21

webkivy

Remote live edit and HTTP deployment of Python applications on Android
Python
11
star
22

backend-developer-hiring-exercise

This is a software development exercise for a TypeScript / Node.js backend developer position.
TypeScript
10
star
23

silvuple

Translation manager for Plone / LinguaPlone websites
Python
8
star
24

Eric-Cartman

Javascript based client-side shopping cart implementation
JavaScript
8
star
25

viral-aave-save-game

A blockchain game where punctual penny savers are rewarded
JavaScript
8
star
26

advanced-fungible

Advanced Fungible is a modern, secure and user-friendly token standard for NEAR protocol
Rust
8
star
27

FontAwesome-and-Bootstrap-social-icons-example

Using FontAwesome and CSS3 to create social media icons in pure HTML and CSS
8
star
28

require-js-mooapp-tutorial

For HelsinkiJS 2012 June meet-up
JavaScript
7
star
29

senorita.plonetool

Sysadmin helper tools to create and manage Plone sites
Python
6
star
30

finmeetup

A venture to make Finland's meetups run in more civilized manner
6
star
31

ethereum-blockchain-docker-compose

Docker composes for various Ethereum blockchains: Mainnet, Polygon, Binance Smart Chain
Dockerfile
6
star
32

hiring-tools-stackoverflow-github

Scrape user StackOverflow profile reputations into Google Spreadsheet
Python
5
star
33

how-to-hire-developers

How to hire developers
4
star
34

capitalgram-onchain-dex-quant-data

Python library and API to do quantative analysis for on-chain trading
Python
4
star
35

mobilejoomla

MoibleJoomla! mobile CMS development
PHP
4
star
36

moot.it-single-signon-example

Django and moot.it forums integration example
Python
4
star
37

ms.amp

Buildout for installing Mobilejoomla! on AMP stack from the scratch
Python
4
star
38

frontend-developer-hiring-exercise

An assessment to checkout frontend developer position hires
TypeScript
4
star
39

binance-api-test-tool

A command line tool for Binance Spot Testnet to test your application integration
Python
4
star
40

sphinxcontrib.contributors

Show document contributors on the page
Python
3
star
41

mfabrik.facebookcampaignengine

Easily create Facebook campaigns using Google App engine
Python
3
star
42

imageportlet

An image portlet for Plone 4
Python
3
star
43

plomobile

Plomobile is a modern mobile site solution for Plone CMS. It delivers good mobile user experience on both smartphones and thin client mobile browsers.
JavaScript
3
star
44

visualtitle

Have different navigation and in-page text title in Plone
Python
3
star
45

CocosNet

A port of Cocos2D to C#. Initially intended for MonoTouch and Mono, but with other .NET environments on the horizon. Very new project, not generally usable just yet, but improving rapidly.
C#
3
star
46

django-nonrel-appengine-sample

Sampel project for django-nonrel-appengine buildout
Python
2
star
47

joomcopy

Copy remote Joomla! site to a local computer
2
star
48

mfabrik.scanner

Easy network scanning for Python
Python
2
star
49

testrepo

How this freaking thing works
2
star
50

stakewise-oracle-docker-compose

Docker compose for setting up Stakewise Oracle
Shell
2
star
51

collective.z3cform.datepicker

z3c.form datepicker reworked to be perfect
Python
2
star
52

ansible-steem

Ansible playbook for setting up Steem miner
Python
2
star
53

collective.cartman

Eric Cartman integration for Plone
Python
2
star
54

mopedwarriors

A multi-player game in HTML5 and Python
JavaScript
2
star
55

ffmpegandmencoderbuilder

ffmpeg and mencoder automatic download, configuration and compile script
1
star
56

hubot-open-webhook

Easily send chat messages from shell scripts and any programming language
CoffeeScript
1
star
57

eggify

Create proper Python egg packages for old style Plone add-ons
Python
1
star
58

sublime-text-gettext

Gettext .po file support for Sublime Text 2
1
star
59

caipirinha

Miss Caipirinha is an IRC help bot provided as service
Python
1
star
60

mfabrik.sms

Send SMS using mFabrik SMS service
Python
1
star
61

plone.z3cform

plone.z3cform patches
1
star
62

Recorder

Simple recorder app for iPhone
1
star
63

quant-web

Web frontend for Capitalgram data
CSS
1
star
64

tokens

TokenMarket tokens
Python
1
star
65

tweetantistorm

Scrape a Twitter post thread and make a blog post out of it
Python
1
star
66

listlessview

Provide empty folder listing view for Plone folders
Python
1
star
67

gigbot

Find Python / JavaScript gigs in San Francisco Bay Area
Python
1
star
68

niteoweb.loginas

Hacked niteoweb.loginas to allow "sudo" on Plone site
Python
1
star
69

slideshow9000

Because I can
JavaScript
1
star
70

scrapekit

Python
1
star
71

archetypes.encryptedfield

Symmetric string value encryption for Plone Archetypes content system
Python
1
star
72

superpants

Plone IDE hacking
1
star