Code Monkey home page Code Monkey logo

bitcoin-cigs's Introduction

Bitcoin Cigs - Smokin' Hot Bitcoin Signatures

Installation

~$ gem install bitcoin-cigs

Command Line

Usage:

~$ bitcoin-cigs 
Usage: bitcoin-cigs command [arguments ...] [options ...]

Commands
     verify bitcoin-address signature [message-file]
     sign private-key [message-file]

Options
    -m, --message MESSAGE            Message can also be read from STDIN
    -S, --no-strip                   Do not strip leading and trailing whitespace from message (stripped by default)

Examples:

~$ # Sign with -m message parameter
~$ bitcoin-cigs sign 5JFZuDkLgbEXK4CUEiXyyz4fUqzAsQ5QUqufdJy8MoLA9S1RdNX -m 'this is a message'
HIBYi2g3yFimzD/YSD9j+PYwtsdCuHR2xwIQ6n0AN6RPUVDGttgOmlnsiwx90ZSjmaWrH1/HwrINJbaP7eMA6V4=
~$ 
~$ # Verify with message from STDIN
~$ echo 'this is a message' | bitcoin-cigs verify 11o51X3ciSjoLWFN3sbg3yzCM8RSuD2q9 HIBYi2g3yFimzD/YSD9j+PYwtsdCuHR2xwIQ6n0AN6RPUVDGttgOmlnsiwx90ZSjmaWrH1/HwrINJbaP7eMA6V4=
~$ 
~$ # Verify with message from file
~$ echo 'this is a message' > message.txt
~$ bitcoin-cigs verify 11o51X3ciSjoLWFN3sbg3yzCM8RSuD2q9 HIBYi2g3yFimzD/YSD9j+PYwtsdCuHR2xwIQ6n0AN6RPUVDGttgOmlnsiwx90ZSjmaWrH1/HwrINJbaP7eMA6V4= message.txt
~$ 

Ruby API

Sign a message:

require 'rubygems'
require 'bitcoin-cigs'

# Support for Wallet Import Format, Compressed WIF, Mini Format, Hex and Base64 wallets
wallet_key = "5JFZuDkLgbEXK4CUEiXyyz4fUqzAsQ5QUqufdJy8MoLA9S1RdNX"
message = "this is a message"

puts "The signature is: #{BitcoinCigs.sign_message!(wallet_key, message)}"

Verify a message signature:

require 'rubygems'
require 'bitcoin-cigs'

address = "11o51X3ciSjoLWFN3sbg3yzCM8RSuD2q9"
signature = "HIBYi2g3yFimzD/YSD9j+PYwtsdCuHR2xwIQ6n0AN6RPUVDGttgOmlnsiwx90ZSjmaWrH1/HwrINJbaP7eMA6V4="
message = "this is a message"

if BitcoinCigs.verify_message(address, signature, message)
  puts "It looks like you own address #{address}!"
end

Credits

Thanks to jackjack for pointing me to Armory's implementation of message signatures: https://github.com/jackjack-jj/jasvet

Bitcoin Cigs is maintained by Michael Pearce.

Donation

If you find this software useful and wish to donate, you can do so here:

1Cyd1wG4hCXK5aRCJQu3KnnhSrrfgs7NeM

Copyright

Copyright (c) 2013 Michael Pearce. See LICENSE.txt for further details.

bitcoin-cigs's People

Contributors

sashazykov avatar

Watchers

 avatar  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.