Skip to content

Akiiki/cert-issuer

 
 

Repository files navigation

Digital Certificates Issuer Project

Issues digital certificates by creating a transaction from the issuing institution to the recipient on the Bitcoin blockchain that includes the hash of the certificate itself. See the schema

Quick start

This uses bitcoind in regtest mode. This route makes many simplifications to allow a quick start, and is intended for experimenting only.

  1. Install Docker Engine and Docker Compose

  2. Clone the repo:

    git clone https://github.com/digital-certificates/cert-issuer.git
    
  3. From a command line in cert-issuer dir, build your docker container:

    cd cert-issuer
    docker build -t ml/cert-issuer:1.0 .
    
  4. Read before running!

    • Once you launch the docker container, you will make some changes using your personal issuing information. This flow mirrors what you would if you were issuing real certificates.

    • To avoid losing your work, you should create snapshots of your docker container. You can do this by running:

      docker ps -l
      docker commit <container for your ml/cert-issuer> my_cert_issuer
      
  5. When you're ready to run:

    docker run -it ml/cert-issuer:1.0 bash
    
  6. Start bitcoind. This will use the bitcoin.conf from the docker container, which runs in regtest mode:

    bitcoind -daemon
    

Create issuing and revocation addresses

Important: this is a simplification to avoid using a USB, which needs to be inserted and removed during the standard certficate issuing process. Do not use these addresses or private keys for anything other than experimenting.

Ensure your docker image is running and bitcoind process is started

  1. Create an 'issuing address' and save the output as follows:

    issuer=`bitcoin-cli getnewaddress`
    sed -i.bak "s/<issuing-address>/$issuer/g" /etc/cert-issuer/conf.ini
    bitcoin-cli dumpprivkey $issuer > /etc/cert-issuer/pk_issuer.txt
    
  2. Create a 'revocation address' and save the output as follows. Note that we don't need to save this corresponding private key for testing issuing certificates:

    revocation=`bitcoin-cli getnewaddress`
    sed -i.bak "s/<revocation-address>/$revocation/g" /etc/cert-issuer/conf.ini
    
  3. Don't forget to save snapshots so you don't lose your work (see step 3 of client setup)

Issuing certificates

  1. Add your certificates to /etc/cert-issuer/data/unsigned_certs/

    • To preview the certificate issuing workflow, you can add our sample unsigned certificate as follows. Note that we are renaming the file to the uid field in the unsigned certificate
    cp /cert-issuer/docs/sample_unsigned_cert.json /etc/cert-issuer/data/unsigned_certs/68656c6c6f636f6d7077ffff.json
    
  2. Make sure you have enough BTC in your issuing address.

    a. You're using bitcoind in regtest mode, so you can print money. This should give you 50 (fake) BTC:

    bitcoin-cli generate 101
    bitcoin-cli getbalance
    

    b. Send the money to your issuing address -- note bitcoin-cli's standard denomination is bitcoins not satoshis! In our app, the standard unit is satoshis. This sends 5 bitcoins to the address

    bitcoin-cli sendtoaddress $issuer 5
    
  3. Run TODO: There is an cert-issuer the Dockerfile and/or setup.py. The pip install here shouldn't be required. For now, these get it running:

    source /cert-issuer/env/bin/activate
    cd cert-issuer
    pip install .
    cert-issuer -c /etc/cert-issuer/conf.ini
    

Project Documentation

Project documentation is under docs/ and summarized here: docs/index.md

http://cert-issuer.readthedocs.io/

About the Digital Certificates project

MIT Media Lab Digital Certificates is an incubation project. We're looking for feedback, contributions, and general discussion. This is not currently intended for production release, but we are improving our approach for future releases.

Contact

Contact certs@media.mit.edu with questions

About

Issues digital certificates using the Bitcoin blockchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.9%
  • Shell 1.1%