|
| 1 | +# centralbank library / gem and command line tool |
| 2 | + |
| 3 | +print your own money / cryptocurrency; run your own federated central bank nodes on the blockchain peer-to-peer over HTTP; revolutionize the world one block at a time |
| 4 | + |
| 5 | + |
| 6 | +* home :: [github.com/openblockchains/centralbank](https://github.com/openblockchains/centralbank) |
| 7 | +* bugs :: [github.com/openblockchains/centralbank/issues](https://github.com/openblockchains/centralbank/issues) |
| 8 | +* gem :: [rubygems.org/gems/centralbank](https://rubygems.org/gems/centralbank) |
| 9 | +* rdoc :: [rubydoc.info/gems/centralbank](http://rubydoc.info/gems/centralbank) |
| 10 | + |
| 11 | + |
| 12 | +## Command Line |
| 13 | + |
| 14 | +Use the `centralbank` command line tool. Try: |
| 15 | + |
| 16 | +``` |
| 17 | +$ centralbank -h |
| 18 | +``` |
| 19 | + |
| 20 | +resulting in: |
| 21 | + |
| 22 | +``` |
| 23 | +Usage: centralbank [options] |
| 24 | +
|
| 25 | + Wallet options: |
| 26 | + -n, --name=NAME Address name (default: Alice) |
| 27 | +
|
| 28 | + Server (node) options: |
| 29 | + -o, --host HOST listen on HOST (default: 0.0.0.0) |
| 30 | + -p, --port PORT use PORT (default: 4567) |
| 31 | + -h, --help Prints this help |
| 32 | +``` |
| 33 | + |
| 34 | +To start a new (network) node using the default wallet |
| 35 | +address (that is, Alice) and the default server host and port settings |
| 36 | +use: |
| 37 | + |
| 38 | +``` |
| 39 | +$ centralbank |
| 40 | +``` |
| 41 | + |
| 42 | +Stand back ten feets :-) while starting up the machinery. |
| 43 | +Ready to print (mine) money on the blockchain? |
| 44 | +In your browser open up the page e.g. `http://localhost:4567`. Voila! |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +Note: You can start a second node on your computer - |
| 51 | +make sure to use a different port (use the `-p/--port` option) |
| 52 | +and (recommended) |
| 53 | +a different wallet address (use the `-n/--name` option). |
| 54 | +Example: |
| 55 | + |
| 56 | +``` |
| 57 | +$ centralbank -p 5678 -n Bob |
| 58 | +``` |
| 59 | + |
| 60 | +Happy mining! |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +## Local Development Setup |
| 65 | + |
| 66 | +For local development - clone or download (and unzip) the centralbank code repo. |
| 67 | +Next install all dependencies using bundler with a Gemfile e.g.: |
| 68 | + |
| 69 | +``` ruby |
| 70 | +# Gemfile |
| 71 | + |
| 72 | +source "https://rubygems.org" |
| 73 | + |
| 74 | +gem 'sinatra' |
| 75 | +gem 'sass' |
| 76 | +gem 'blockchain-lite' |
| 77 | +``` |
| 78 | + |
| 79 | +run |
| 80 | + |
| 81 | +``` |
| 82 | +$ bundle ## will use the Gemfile (see above) |
| 83 | +``` |
| 84 | + |
| 85 | +and now you're ready to run your own centralbank server node. Use the [`config.ru`](config.ru) script for rack: |
| 86 | + |
| 87 | +``` ruby |
| 88 | +# config.ru |
| 89 | + |
| 90 | +$LOAD_PATH << './lib' |
| 91 | + |
| 92 | +require 'centralbank' |
| 93 | + |
| 94 | +run Centralbank::Service |
| 95 | +``` |
| 96 | + |
| 97 | +and startup the money printing machine using rackup - the rack command line tool: |
| 98 | + |
| 99 | +``` |
| 100 | +$ rackup ## will use the config.ru - rackup configuration script (see above). |
| 101 | +``` |
| 102 | + |
| 103 | +In your browser open up the page e.g. `http://localhost:9292`. Voila! Happy mining! |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +## References |
| 109 | + |
| 110 | +[**Programming Cryptocurrencies and Blockchains (in Ruby)**](http://yukimotopress.github.io/blockchains) by Gerald Bauer et al, 2018, Yuki & Moto Press |
| 111 | + |
| 112 | + |
| 113 | +## License |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | +The `centralbank` scripts are dedicated to the public domain. |
| 118 | +Use it as you please with no restrictions whatsoever. |
0 commit comments