OpenCerts/admin-website

How can I publish a pdf file in opencert?

Closed this issue · 20 comments

How to publish a pdf file in opencert?
I understood how to verify file, but where can I upload my pdf file into this and secure it?

Hi,

Please avoid to open the same issue on many repositories.

You can eventually embed documents in opencerts file (https://github.com/TradeTrust/tradetrust-schema/blob/master/schema/1.0/schema.json#L91). However your renderer will need to be able to render it

  1. Renderer means who in this case?

  2. When I go to admin page, where can I put the json schema and publish the document?

If I have 'topsecret.pdf' which contains 10 pages.
How can I put into opencert and get .tt file?

  1. https://docs.opencerts.io/document_renderer.html#issuing-new-certificate (the first part of the doc is outdated, better to start with https://github.com/Open-Attestation/decentralized-renderer-react-template)

  2. https://docs.opencerts.io/creating_certificates.html but better to follow v2 https://docs.opencerts.io/announcements/schema2_update.html

opencerts and tradetrust file use the same tech, just a different content (so difference schema validation)

I have runned admin website successfully in my local machine,
Deployed new instance in http://localhost:3000/deploy with ropsten metamask
How to generate document in this http://localhost:3000/generate-document
I cant see my instance in generate document?
If I use anyother issuer its not working

I think you are mixing opencerts and tt, opencerts doesnt have generate-document.

@sumitnitsurat built this and may help you

HI @rohanashik . First I hope you are using TradeTrust admin website code - https://github.com/TradeTrust/admin-website.

To batch the pdf -

  1. Crea te the document store. You can use admin.tradetrust.io to create it or on localhost.
  2. Add this document store to /createDocument/store.js file in the array.
  3. not you can use localhost:3000/generate-document to batch the pdf document. and tets it on dev.tradetrust.io.
  1. Done
  2. Done
  3. The tt file, which I have generated, is showing invalid issuer in dev.tradetrust.io

I Issued the document in ropsten

Invalid issuer error means your document is not associated with the domain name you own. search for "stanchart.tradetrust.io" in code and replace it with the your domain name and add the document store to your domain`s DNT-TXT record.

Now works, and another doubt,

  1. How tt file is generated from PDF and issuer?

  2. What kind of hash do you use for every value?
    Eg "id": "d0ddc0b5-30b4-4df1-82d1-c5cbbdbaab4e:string:1581670287787",
    How do you generate this hash?
    "d0ddc0b5-30b4-4df1-82d1-c5cbbdbaab4e"

  3. What hash is sent to contract in issue function?

Access to fetch at 'https://api-ropsten.opencerts.io/verify' from origin 'http://localhost' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.

When I call from js ajax its showing this error, but if I try in postman its working?

Hi
@rohanashik for your first query -

How tt file is generated from PDF and issuer?

  • tt file is nothing but just a json formatted data with appended salt in each field. now we apply Merle tree algorithm to generate the merkle room of this json. this merkle root is then published to the blockchain.

What kind of hash do you use for every value?
Eg "id": "d0ddc0b5-30b4-4df1-82d1-c5cbbdbaab4e:string:1581670287787",
How do you generate this hash?
"d0ddc0b5-30b4-4df1-82d1-c5cbbdbaab4e"

What hash is sent to contract in issue function?

  • check the signature section in document you will find key "merkleroot". This key is published to the blockchain.

For CORS error I need to check that.

Thats cool, Clearly understood,
From what inputs did merkle root hash is derived from?

all the key i.e "id": "d0ddc0b5-30b4-4df1-82d1-c5cbbdbaab4e:string:1581670287787" accumulates to one merkle root (check merkle root algorithm for that). So if you change any key, even a single charactor your merkle root would result in different hash value.

Yeah I understand the concept of merkle root hash. Can you show me the diagram of how these keys constructively build to merkle. I applied merkle algorithm. but the hash is showing different

Looking for your fast response, please tell me, how these keys constructively build to merkle root hash. I tried all ways. I couldn't get the output

Please go through the logic written - https://github.com/Open-Attestation/open-attestation/tree/master/src/signature. check out the merkle tree algo written and mapout your document with this.

Okay I figured it out!, what happened to CORS error ?

Looking for quick reply!

HI @rohanashik, I've noticed that a lot of questions are on topics that are requires deep technical expertise in the framework. To help us prioritise your queries, it will help if you could explain what are your trying to do/build.

Also, if you feel that the documentation is inadequate in addressing the technical depth of the framework, we are currently working on our documentation to address the needs of contributors. Please feel free to extend on our work on the documentation at https://github.com/Open-Attestation/documentation-website. After all, the best way to learn is to teach.

Will proceed to close this issue as the original question has been addressed.