Flask app Cert-Issuer for Ethereum

I am looking to run Cert issuer module as a Flask App.

So instead of using command line : cert-issuer -c conf_ethtest.ini [ I am able to generate an Ethereum ropsten certificate thru this command]
It should be a Flask app that can be deployed.

I checked the app.py in cert-issuer but It seems to me this is a flask app for issuing Bitcoin certificate.
But I want to do it in Ethereum chain.

**1) It would be great if someone can point me to Ethereum Flask app (if its there) **
**2) or Do I need to change this to Ethereum. **
**3) If yes then how and **
4) Do I need to rebuild anything to reflect the code changes?

There hasn’t been much activity on the Flask app in a long time. I doubt there’s much intent to support it officially. However, looking at the code, you might be able to make a few small adjustments to try this out.

Right now, it looks like this:

import json
from flask import Flask, jsonify, request, abort
from subprocess import call

import cert_issuer.config
from cert_issuer.blockchain_handlers import bitcoin
import cert_issuer.issue_certificates

app = Flask(__name__)
config = None

def get_config():
    global config
    if config == None:
        config = cert_issuer.config.get_config()
    return config

@app.route('/cert_issuer/api/v1.0/issue', methods=['POST'])
def issue():
    config = get_config()
    certificate_batch_handler, transaction_handler, connector = \
            bitcoin.instantiate_blockchain_handlers(config, False)
    cert_issuer.issue_certificates.issue(config, certificate_batch_handler, transaction_handler)
    return json.dumps(certificate_batch_handler.proof)

if __name__ == '__main__':

If you adjust the blockchain handler import, and its reference, to refer to ethereum instead of bitcoin, maybe that would work?


from cert_issuer.blockchain_handlers import bitcoin


from cert_issuer.blockchain_handlers import ethereum


bitcoin.instantiate_blockchain_handlers(config, False)


ethereum.instantiate_blockchain_handlers(config, False)

So long as it loads the config file that you want, it might work. I haven’t tested this, but it might be worth a try, if you’d like to give it a shot.

Thanks for this. Will try this out.

This thing still showed me a couple of errors.

But Issue fixed as I changed my approach :
Now I ran the cert_issuer as a subprocess and it worked.