# Flask app Cert-Issuer for Ethereum

**URL:** <https://community.blockcerts.org/t/flask-app-cert-issuer-for-ethereum/3089>\
**Category:** Technical\
**Created:** [February 16, 2022, 4:56pm UTC](https://community.blockcerts.org/t/flask-app-cert-issuer-for-ethereum/3089 "2022-02-16T16:56:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitinb](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@nitinb](https://community.blockcerts.org/u/nitinb)\
**Post date:** [February 16, 2022, 4:56pm UTC](https://community.blockcerts.org/t/flask-app-cert-issuer-for-ethereum/3089/1 "2022-02-16T16:56:04Z")

</div>

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?**

---

<div class="post-metadata">

**Author:** ![lparker](https://avatars.discourse-cdn.com/v4/letter/l/3bc359/32.png) [@lparker](https://community.blockcerts.org/u/lparker)\
**Post date:** [March 1, 2022, 12:29am UTC](https://community.blockcerts.org/t/flask-app-cert-issuer-for-ethereum/3089/2 "2022-03-01T00:29:48Z")

</div>

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:

```auto
#!/usr/bin/python3
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)
    certificate_batch_handler.set_certificates_in_batch(request.json)
    cert_issuer.issue_certificates.issue(config, certificate_batch_handler, transaction_handler)
    return json.dumps(certificate_batch_handler.proof)

if __name__ == ' __main__':
    app.run(host='0.0.0.0')

```

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

So,

```auto
from cert_issuer.blockchain_handlers import bitcoin

```

becomes,

```auto
from cert_issuer.blockchain_handlers import ethereum

```

And,

```auto
bitcoin.instantiate_blockchain_handlers(config, False)

```

becomes,

```auto
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.

---

<div class="post-metadata">

**Author:** ![nitinb](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@nitinb](https://community.blockcerts.org/u/nitinb)\
**Post date:** [March 9, 2022, 10:51am UTC](https://community.blockcerts.org/t/flask-app-cert-issuer-for-ethereum/3089/3 "2022-03-09T10:51:32Z")

</div>

@lparker  
Thanks for this. Will try this out.

---

<div class="post-metadata">

**Author:** ![nitinb](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@nitinb](https://community.blockcerts.org/u/nitinb)\
**Post date:** [May 18, 2022, 1:23pm UTC](https://community.blockcerts.org/t/flask-app-cert-issuer-for-ethereum/3089/4 "2022-05-18T13:23:27Z")

</div>

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.
