├── .gitmodules ├── LICENSE ├── Readme.md ├── client ├── .env.example ├── .gitignore ├── Dockerfile ├── README.md ├── build.sh ├── package-lock.json ├── package.json ├── public │ ├── etherdocs_logo.png │ ├── favicon.ico │ ├── images │ │ ├── happy-student-with-graduation-hat-diploma.webp │ │ ├── university.jpg │ │ └── verify.jpg │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── RegisteredData.js │ ├── UnRegisteredData.js │ ├── components │ ├── Card.js │ ├── DarkModeSwitch.js │ ├── FeatureBox.js │ ├── FileUpload.js │ ├── Footer.js │ └── Navbar.js │ ├── config.js │ ├── hooks │ ├── useClient.jsx │ ├── useMetamask.jsx │ └── useProfile.jsx │ ├── index.css │ ├── index.js │ ├── lib │ ├── EtherDocsClient.js │ └── Etherdocs.json │ ├── logo.svg │ ├── pages │ ├── CertificatePage.js │ ├── ConnectWalletPage.js │ ├── Index.js │ ├── IssueNewCertiForm.js │ ├── IssuerForm.js │ ├── IssuerIsRegistered.js │ ├── LandingPage.js │ ├── NotRegisteredUserPage.js │ ├── RegisteredUserPage.js │ ├── StudentForm.js │ ├── StudentIsRegistered.js │ ├── VerifyForm.js │ └── WarningInstallMetaMask.js │ ├── reportWebVitals.js │ ├── scripts │ └── loadAbi.sh │ ├── setupTests.js │ └── styles │ └── Home.module.css ├── docker-compose.yaml ├── docker-setup.txt └── server ├── .gitignore ├── .nvmrc ├── Dockerfile ├── dummy.pdf ├── dummy2.pdf ├── index.js ├── package-lock.json └── package.json /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "smart_contracts"] 2 | path = smart_contracts 3 | url = https://github.com/ShyrenMore/etherdocs_smart_contracts 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
7 | 8 | Logo 9 | 10 | 11 | 12 |

13 | A Student Document Management System based on Ethereum Blockchain 14 |
15 | Explore the docs » 16 |
17 |
18 | Demo 19 | 20 |

21 |
22 | 23 | 24 | 25 | 26 |
27 | Table of Contents 28 |
    29 |
  1. About the project
  2. 30 |
  3. Features
  4. 31 |
  5. 32 | Architecture 33 | 38 |
  6. 39 |
  7. Technologies used
  8. 40 |
  9. Local Setup
  10. 41 |
  11. Authors
  12. 42 |
  13. Contact
  14. 43 |
44 |
45 | 46 | ## Contact 47 | 48 | - For help with local setup contact on [Telegram](https://telegram.me/ShyrenMore) 49 | - Don't forget to star ⭐ the repo 50 | 51 | 52 | ## About The Project 53 | 54 |

55 | 56 | 57 | https://user-images.githubusercontent.com/56788568/232264163-0fda63cf-b204-43a2-ac7e-ab7e82a53ad8.mp4 58 | 59 | 60 |

61 | 62 | 63 | Etherdocs is a project that aims to implement an efficient anti-forgery mechanism for academic documents, such as mark sheets, transcripts, diplomas, and other certificates. The goal is to ensure the authenticity of academic documents, reducing the incidence of counterfeit certificates, and saving time and financial resources for all parties involved in document verification. 64 | 65 | The solution proposed by Etherdocs revolves around three roles or entities: **an Issuer, a Verifier, and a Student**. 66 | * The issuer is the authority that creates and issues the electronic version of the certificate, eg: A university issuing graduating certificates 67 | * Verifier is the potential employer or any person who wants to verify the authenticity of the certificate provided by the student, eg: A potential employer doing background check. 68 | * Finally, the student is the recipient of the certificate and can only view the documents issued to him. 69 | 70 | Etherdocs is a project that provides an efficient anti-forgery mechanism for academic documents. By using a combination of blockchain, IPFS, and hash functions, the authenticity of the certificate can be ensured, reducing the incidence of counterfeit certificates and saving time and financial resources for all parties involved in document verification. 71 | 72 |

(back to top)

73 | 74 | ## Features 75 | 76 | - **Security:** By using blockchain, IPFS, and hash functions, Etherdocs provides a highly secure platform for storing and verifying academic documents. The blockchain is tamper-proof and immutable, ensuring that the data stored on it cannot be modified or deleted. The use of hash functions ensures that any modification to the document will be detected, making it difficult for counterfeit certificates to be created. 77 | - **Efficiency:** Etherdocs streamlines the process of verifying academic documents, saving time and resources for all parties involved. Verifiers can easily access the certificates and compare the hash values, eliminating the need for manual verification. 78 | - **Accessibility:** Etherdocs makes it easy for students to access and share their academic documents. The use of IPFS allows for quick and easy access to the documents, while the UUID ensures that the documents are easily identifiable and verifiable. 79 | - **Transparency:** The use of blockchain ensures transparency and accountability in the issuance and verification of academic documents. All data related to the certificate and the IPFS link are stored on the blockchain, providing a transparent and auditable record of the entire process. 80 | - **Universality:** Etherdocs can be used by any educational institution, making it a universal solution for ensuring the authenticity of academic documents. The platform can also be used by potential employers, government agencies, or any organization that needs to verify the authenticity of academic documents. 81 | 82 | The Etherdocs project is needed because the current system of issuing and verifying academic documents is prone to fraud and counterfeiting. Without an efficient anti-forgery mechanism, it is difficult to ensure the authenticity of academic documents, leading to wasted time and resources for all parties involved. Etherdocs provides a secure, efficient, and transparent solution for verifying academic documents, ensuring that the information on the certificate is accurate and trustworthy. 83 | 84 |

(back to top)

85 | 86 | ## Architecture 87 | 88 | 89 | ### Issuer workflow process 90 | 91 | - The below diagram shows the overview of the issuer part of system. 92 | 93 | ![image](https://user-images.githubusercontent.com/56788568/231941576-ab87de05-b081-42b0-b569-f5e615c6947a.png) 94 | 95 | 1. Issuer submits raw doc and user's blockchain address 96 | 2. Send raw document to Node server 97 | 3. Generation of UUID and QR 98 | Generate UUID and QR Code, append QR code and UUID to document 99 | Calculate hash of document with QR 100 | 4. Upload doc with QR code to IPFS 101 | 5. React receives IPFS link & hash value of doc from Node server 102 | 6. Store hash value, issuer address, user address and IPFS link 103 | 7. React app returns a response: hash value, issuer and user address, IPFS link 104 | 105 | ### Verifier workflow process 106 | 107 | - The below diagram shows the overview of the verifier part of system. 108 | 109 | ![image](https://user-images.githubusercontent.com/56788568/231941877-eb61e3ad-06c7-4e1c-8652-ae37590accf2.png) 110 | 111 | 0. The student has sent a digital document with a QR code, UUID, issuer name, user address, and user's name. 112 | 1. Find the authentic address of the issuer. 113 | 2. Enter the document with the QR code, UUID, issuer address, user address, and user name. 114 | 3. Pass the document to the node server. 115 | 4. Compute the hash value of the document entered by the verifier. 116 | 5. Return the hash value. 117 | 6. Send the UUID, hash value, issuer address, user address, and user name to the blockchain for verification. 118 | 7. Execute the smart contract for verification by matching the UUID associated with the user's address and name and the hash with the verifier-provided details. 119 | 8. Return the result of verification to the React App. 120 | 9. Return the verification result to the verifier. 121 | 122 | ### Use-case diagrams 123 | 124 | - The below are use-case diagrams of Issuer, Verifier and User(Student) 125 | 126 | ![image](https://user-images.githubusercontent.com/56788568/231942409-48843d21-7ffe-436b-91b2-350b8588f00b.png) 127 | 128 | ![image](https://user-images.githubusercontent.com/56788568/231942481-18024564-9c8a-4de5-81c1-3bf7f18d2cf3.png) 129 | 130 | ![image](https://user-images.githubusercontent.com/56788568/231942572-55d21117-059a-4aa0-b506-4cd6f67ce25d.png) 131 | 132 |

(back to top)

133 | 134 | ## Corner-cases 135 | 136 | In the event of a human error while issuing a certificate, the issuer can use the invalidate button to invalidate the certificate. This will revoke the certificate's validity and remove it from the blockchain, ensuring that it cannot be used for verification. 137 | 138 | The invalidate button can only be accessed by the issuer and is not visible to the student or verifier. This ensures that the issuer has complete control over the validity of the certificates they issue and can take action to correct any errors or revoke certificates that have been issued in error. 139 | 140 | By providing a mechanism for revoking certificates, the Etherdocs system ensures the integrity of the certification process and reduces the risk of fraudulent or erroneous certificates being used for verification. 141 | 142 |

(back to top)

143 | 144 | ## Technologies Used 145 | 146 | - Workflow and Architecture Design 147 | - Excalidraw • Draw.io 148 | - Frontend 149 | - React.js and related packages 150 | - CSS and related packages 151 | - Blockchain network: Ethereum 152 | - Smart contracts are written in **Solidity** programming language 153 | - Smart contracts compilation and deployment to test network was done using **Hardhat** 154 | - Blockchain wallet used: **MetaMask** 155 | - Javascript library to communicate with blockchain: **Ethers.js** 156 | - **IPFS Desktop** for interacting with IPFS without using terminal 157 | 158 |

(back to top)

159 | 160 | 161 | ## License 📜 162 | 163 | [GNU General Public License v3.0](/LICENSE) 164 | 165 | ## Authors 166 | 167 | **Project Guide** 168 | 169 | - Dr. Tasneem Mirza 170 | - [LinkedIn](https://www.linkedin.com/in/tasneem-mirza-91513338/) • [Mail](mailto:tmm1207@gmail.com) 171 | 172 | **Developers** 173 | 174 | - Aniket More 175 | - [LinkedIn](https://www.linkedin.com/in/aniket-more-2b97571b1/) • [Mail](mailto:aniketavinashmore33@gmail.com) 176 | - Chirag Mahajan 177 | - [Linkedin](https://www.linkedin.com/in/chirag-mahajan-b09144137/) • [Mail](mailto:chiragmahajan3101@gmail.com) 178 | - Shyren More 179 | - [LinkedIn](https://www.linkedin.com/in/shyrenmore/) • [Mail](mailto:shyren.more30@gmail.com) 180 | - Shubhankar Mote 181 | - [LinkedIn](https://www.linkedin.com/in/shubhankarmote/) • [Mail](mailto:shubhu.mote@gmail.com) 182 | 183 |

(back to top)

184 | -------------------------------------------------------------------------------- /client/.env.example: -------------------------------------------------------------------------------- 1 | REACT_APP_CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3 -------------------------------------------------------------------------------- /client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | .env 4 | 5 | # dependencies 6 | /node_modules 7 | /.pnp 8 | .pnp.js 9 | 10 | # testing 11 | /coverage 12 | 13 | # production 14 | /build 15 | 16 | # misc 17 | .DS_Store 18 | .env.local 19 | .env.development.local 20 | .env.test.local 21 | .env.production.local 22 | 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | todos.txt -------------------------------------------------------------------------------- /client/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use the official Node.js image 2 | FROM node:16 3 | 4 | # Set the working directory 5 | WORKDIR /app 6 | 7 | # Copy the package.json and package-lock.json 8 | COPY package*.json ./ 9 | 10 | # Install dependencies 11 | RUN npm install 12 | 13 | # Copy the rest of the application code 14 | COPY . . 15 | 16 | # Expose the Hardhat network port 17 | EXPOSE 3000 18 | 19 | # Start the Hardhat node and deploy the contracts 20 | CMD ["npm","start"] 21 | -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 39 | 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /client/build.sh: -------------------------------------------------------------------------------- 1 | cp -n .env.example .env -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@chakra-ui/icons": "^2.0.14", 7 | "@chakra-ui/react": "^2.4.4", 8 | "@testing-library/jest-dom": "^5.16.5", 9 | "@testing-library/react": "^13.4.0", 10 | "@testing-library/user-event": "^13.5.0", 11 | "axios": "^1.6.0", 12 | "ethers": "^6.13.3", 13 | "react": "^18.2.0", 14 | "react-dom": "^18.2.0", 15 | "react-hook-form": "^7.41.5", 16 | "react-icons": "^4.7.1", 17 | "react-router-dom": "^6.2.1", 18 | "react-scripts": "5.0.1", 19 | "web-vitals": "^2.1.4" 20 | }, 21 | "scripts": { 22 | "start": "react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": [ 29 | "react-app", 30 | "react-app/jest" 31 | ] 32 | }, 33 | "browserslist": { 34 | "production": [ 35 | ">0.2%", 36 | "not dead", 37 | "not op_mini all" 38 | ], 39 | "development": [ 40 | "last 1 chrome version", 41 | "last 1 firefox version", 42 | "last 1 safari version" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /client/public/etherdocs_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/client/public/etherdocs_logo.png -------------------------------------------------------------------------------- /client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/client/public/favicon.ico -------------------------------------------------------------------------------- /client/public/images/happy-student-with-graduation-hat-diploma.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/client/public/images/happy-student-with-graduation-hat-diploma.webp -------------------------------------------------------------------------------- /client/public/images/university.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/client/public/images/university.jpg -------------------------------------------------------------------------------- /client/public/images/verify.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/client/public/images/verify.jpg -------------------------------------------------------------------------------- /client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | EtherDocs 📑 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/client/public/logo192.png -------------------------------------------------------------------------------- /client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/client/public/logo512.png -------------------------------------------------------------------------------- /client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /client/src/App.js: -------------------------------------------------------------------------------- 1 | import "./App.css"; 2 | import { useEffect, useState } from "react"; 3 | import { ChakraProvider, extendTheme } from "@chakra-ui/react"; 4 | import { BrowserRouter as Router, Route, Routes, useNavigate, useParams } from "react-router-dom"; 5 | import LandingPage from "./pages/LandingPage"; 6 | import Navbar from "./components/Navbar"; 7 | import RegisteredUserPage from "./pages/RegisteredUserPage"; 8 | import VerifyForm from "./pages/VerifyForm"; 9 | import StudentForm from "./pages/StudentForm"; 10 | import IssuerForm from "./pages/IssuerForm"; 11 | import NotRegisteredUserPage from "./pages/NotRegisteredUserPage"; 12 | import StudentIsRegistered from "./pages/StudentIsRegistered"; 13 | import IssuerIsRegistered from "./pages/IssuerIsRegistered"; 14 | import IssueNewCertiForm from "./pages/IssueNewCertiForm"; 15 | import ConnectWalletPage from "./pages/ConnectWalletPage"; 16 | import CertificatePage from "./pages/CertificatePage"; 17 | import Index from "./pages/Index"; 18 | import WarningInstallMetaMask from "./pages/WarningInstallMetaMask"; 19 | import { useProfile } from "./hooks/useProfile"; 20 | import { useClient } from "./hooks/useClient"; 21 | import { useMetamask } from "./hooks/useMetamask"; 22 | import EtherDocsClient from "./lib/EtherDocsClient"; 23 | import Etherdocs from "./lib/Etherdocs.json"; 24 | import config from "./config"; 25 | 26 | function App() { 27 | const [isMetamaskInstalled] = useState( 28 | window.ethereum === undefined ? false : true 29 | ); 30 | const { setProfile } = useProfile(); 31 | const { isConnected } = useMetamask(); 32 | const { client, setClient } = useClient(); 33 | 34 | useEffect(() => { 35 | (async () => { 36 | if (isMetamaskInstalled) { 37 | const client = new EtherDocsClient( 38 | ); 39 | await client.setup( 40 | Etherdocs.abi, 41 | config.contractAddress 42 | ) 43 | setClient(client); 44 | const profile = await client.getProfile(); 45 | setProfile(profile); 46 | } 47 | })(); 48 | }, [isConnected, isMetamaskInstalled]); 49 | 50 | return ( 51 | <> 52 | 53 | 54 | 55 | 56 | 57 | }> 58 | }> 59 | } 63 | > 64 | } 68 | > 69 | 70 | {/* choice b/w issuer and student */} 71 | } 75 | > 76 | 77 | {/* displays list of certificates issued to the student by various orgs */} 78 | } 82 | > 83 | 84 | {/* displays list of certificates issued by Issuer to various students */} 85 | } 89 | > 90 | 91 | {/* form for new certificate */} 92 | } 96 | > 97 | 98 | {/* displays 3 btns: register as issuer, student, verifier */} 99 | } 103 | > 104 | 105 | {/* verify form, containing fields: Issued by, Issued to, UUID and file upload */} 106 | } 110 | > 111 | 112 | } 116 | > 117 | } 121 | > 122 | {/* displays certificate details issued to the student */} 123 | } 126 | > 127 | 128 | {" "} 129 | 130 | 131 | ); 132 | } 133 | 134 | export default App; 135 | -------------------------------------------------------------------------------- /client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /client/src/RegisteredData.js: -------------------------------------------------------------------------------- 1 | const options = [ 2 | { 3 | id: "student", 4 | name: "Student", 5 | desc: "View all your certificates uploaded by the university", 6 | imageURL: "images/happy-student-with-graduation-hat-diploma.webp", 7 | }, 8 | { 9 | id: "issuer", 10 | name: "Issuer/University", 11 | 12 | desc: "Upload a New Certificate", 13 | imageURL: "images/university.jpg", 14 | } 15 | ] 16 | 17 | export default options; -------------------------------------------------------------------------------- /client/src/UnRegisteredData.js: -------------------------------------------------------------------------------- 1 | const options = [ 2 | { 3 | id: "verify", 4 | name: "Verifier", 5 | desc: "Verify authenticity of certificate", 6 | imageURL: "/images/verify.jpg", 7 | }, 8 | { 9 | id: "student", 10 | name: "Student", 11 | desc: "View all your certificates uploaded by the university", 12 | imageURL: "/images/happy-student-with-graduation-hat-diploma.webp", 13 | }, 14 | { 15 | id: "issuer", 16 | name: "Issuer/University", 17 | desc: "Upload a New Certificate", 18 | imageURL: "/images/university.jpg", 19 | }, 20 | ] 21 | 22 | export default options; -------------------------------------------------------------------------------- /client/src/components/Card.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | useColorModeValue, 4 | Text, 5 | Flex, 6 | Box, 7 | Img, 8 | } from "@chakra-ui/react"; 9 | import { Link } from 'react-router-dom'; 10 | const Card = ({ name, desc, imageURL, id, path }) => { 11 | 12 | return ( 13 | // pls add a Navlink component 14 | 15 | 30 | 31 | {`Picture 40 | 41 | 42 | 48 | 55 | {name} 56 | 57 | 58 | 59 | 60 | 61 | {" "} 62 | 63 | {desc} 64 | 65 | 66 | 67 | 68 | 69 | 70 | ); 71 | }; 72 | 73 | export default Card; 74 | -------------------------------------------------------------------------------- /client/src/components/DarkModeSwitch.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useColorMode, IconButton } from "@chakra-ui/react"; 3 | import { MoonIcon, SunIcon } from "@chakra-ui/icons"; 4 | 5 | const DarkModeSwitch = () => { 6 | const { colorMode, toggleColorMode } = useColorMode(); 7 | return : } 9 | onClick={toggleColorMode}>; 10 | }; 11 | 12 | export default DarkModeSwitch; 13 | -------------------------------------------------------------------------------- /client/src/components/FeatureBox.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | Flex, 4 | Text, 5 | Stack, 6 | useColorModeValue, 7 | Center 8 | } from "@chakra-ui/react"; 9 | 10 | const FeatureBox = ({ title, text, icon }) => { 11 | return ( 12 | 13 |
20 |
23 | {icon} 24 |
25 |
26 |
31 | {title} 32 |
33 |
36 | {text} 37 |
38 |
39 | ); 40 | }; 41 | 42 | export default FeatureBox; 43 | -------------------------------------------------------------------------------- /client/src/components/FileUpload.js: -------------------------------------------------------------------------------- 1 | import { Input, FormControl, FormLabel, InputGroup, InputLeftElement, FormErrorMessage, Icon } from "@chakra-ui/react"; 2 | import { FiFile } from "react-icons/fi"; 3 | import { useController } from "react-hook-form"; 4 | import { useRef } from "react"; 5 | 6 | export const FileUpload = ({ name, placeholder, acceptedFileTypes, control, children, isRequired = false, inputRef }) => { 7 | // const inputRef = useRef(); 8 | const { 9 | field: { ref, onChange, value, ...inputProps }, 10 | fieldState: { invalid, isTouched, isDirty }, 11 | } = useController({ 12 | name, 13 | control, 14 | rules: { required: isRequired }, 15 | }); 16 | 17 | return ( 18 | 19 | {children} 20 | 21 | 23 | 24 | 25 | onChange(e.target.files[0])} 27 | accept={acceptedFileTypes} 28 | name={name} 29 | ref={inputRef} 30 | {...inputProps} 31 | style={{ display: 'none' }} /> 32 | inputRef.current.click()} 35 | // onChange={(e) => {}} 36 | readOnly={true} 37 | value={value && value.name || ''} 38 | /> 39 | 40 | 41 | {invalid} 42 | 43 | 44 | ); 45 | } 46 | 47 | FileUpload.defaultProps = { 48 | acceptedFileTypes: '', 49 | allowMultipleFiles: false, 50 | }; 51 | 52 | export default FileUpload; -------------------------------------------------------------------------------- /client/src/components/Footer.js: -------------------------------------------------------------------------------- 1 | import { 2 | Box, 3 | chakra, 4 | Container, 5 | Link, 6 | Stack, 7 | Text, 8 | useColorModeValue, 9 | VisuallyHidden, 10 | Heading, 11 | useBreakpointValue, 12 | } from "@chakra-ui/react"; 13 | import { FaGithub } from "react-icons/fa"; 14 | 15 | const SocialButton = ({ children, label, href }) => { 16 | return ( 17 | 35 | {label} 36 | {children} 37 | 38 | ); 39 | }; 40 | 41 | export default function Footer() { 42 | return ( 43 | 47 | 48 | 53 | 62 | Creators: Aniket, Chirag, Shyren & Shubhankar 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | ); 72 | } 73 | -------------------------------------------------------------------------------- /client/src/components/Navbar.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { 3 | Box, 4 | Flex, 5 | Text, 6 | IconButton, 7 | Button, 8 | Stack, 9 | useColorModeValue, 10 | useBreakpointValue, 11 | Container, 12 | Heading, 13 | Menu, 14 | MenuButton, 15 | MenuList, 16 | MenuItem, 17 | } from "@chakra-ui/react"; 18 | import DarkModeSwitch from "./DarkModeSwitch"; 19 | import { ChevronDownIcon } from "@chakra-ui/icons"; 20 | import { Link } from "react-router-dom"; 21 | import { useProfile } from "../hooks/useProfile"; 22 | 23 | const Navbar = () => { 24 | const { profile } = useProfile(); 25 | return ( 26 | 27 | 50 | 51 | 52 | 59 | 75 | {/* react royter will come here */} 76 | EtherDocs 📑 77 | 78 | 79 | 80 | 87 | {profile && profile.name != "NA" &&

{profile.name}

} 88 | 89 |
90 | 91 | 92 | 93 |
94 |
95 |
96 | ); 97 | }; 98 | 99 | export default Navbar; 100 | -------------------------------------------------------------------------------- /client/src/config.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | 3 | /** 4 | * 5 | * @param {string} name 6 | * @returns {string} 7 | */ 8 | function getEnvVar(name) { 9 | const val = process.env[name]; 10 | if (!val) { 11 | throw new Error(`env variable ${name} not defined`); 12 | } 13 | return val; 14 | } 15 | 16 | const config = { 17 | contractAddress: getEnvVar("REACT_APP_CONTRACT_ADDRESS"), 18 | }; 19 | 20 | export default config; 21 | -------------------------------------------------------------------------------- /client/src/hooks/useClient.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useState } from "react"; 3 | import { useContext } from "react"; 4 | 5 | const clientContext = React.createContext(); 6 | 7 | export const useClient = () => { 8 | return useContext(clientContext); 9 | }; 10 | 11 | export function ClientProvider({ children }) { 12 | const [client, setClient] = useState(null); 13 | 14 | return ( 15 | 16 | {children} 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /client/src/hooks/useMetamask.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useContext } from "react"; 3 | import { useEffect } from "react"; 4 | import { useCallback } from "react"; 5 | import { useState } from "react"; 6 | import EtherDocsClient from "../lib/EtherDocsClient"; 7 | import Etherdocs from "../lib/Etherdocs.json"; 8 | import config from "../config"; 9 | import { useProfile } from "./useProfile"; 10 | import { useClient } from "./useClient"; 11 | 12 | export const metamaskContext = React.createContext(); 13 | 14 | export const useMetamask = () => { 15 | return useContext(metamaskContext); 16 | }; 17 | 18 | export const MetamaskProvider = ({ children }) => { 19 | const [account, setAccount] = useState(null); 20 | const [isConnected, setIsConnected] = useState(false); 21 | const { setProfile } = useProfile(); 22 | const { client, setClient } = useClient(); 23 | // const value = useClient(); 24 | // console.log(value); 25 | 26 | // useEffect(() => { 27 | // if (!window.ethereum) { 28 | // throw new Error("metamask not installed"); 29 | // } 30 | // }, []); 31 | 32 | const handleAccountsChanged = useCallback( 33 | async (accounts) => { 34 | if (accounts.length === 0) { 35 | console.log("metamask not connected"); 36 | } else { 37 | const client = new EtherDocsClient( 38 | ); 39 | await client.setup( 40 | Etherdocs.abi, 41 | config.contractAddress 42 | ) 43 | setClient(client); 44 | const profileRet = await client.getProfile(); 45 | setProfile(profileRet); 46 | setAccount(accounts[0]); 47 | } 48 | }, 49 | [setAccount, setProfile] 50 | ); 51 | 52 | useEffect(() => { 53 | (async () => { 54 | if (window.ethereum) { 55 | const accounts = await window.ethereum.request({ 56 | method: "eth_accounts", 57 | }); 58 | handleAccountsChanged(accounts); 59 | } 60 | })(); 61 | }, [handleAccountsChanged]); 62 | 63 | useEffect(() => { 64 | if (account === null) { 65 | setIsConnected(false); 66 | } else { 67 | setIsConnected(true); 68 | } 69 | }, [account]); 70 | 71 | const handleChainChanged = useCallback((chainId) => { 72 | window.location.href = "/"; 73 | }, []); 74 | 75 | useEffect(() => { 76 | if (window.ethereum) { 77 | window.ethereum.on("accountsChanged", handleAccountsChanged); 78 | window.ethereum.on("chainChanged", handleChainChanged); 79 | 80 | return () => { 81 | window.ethereum.removeListener( 82 | "accountsChanged", 83 | handleAccountsChanged 84 | ); 85 | window.ethereum.removeListener("chainChanged", handleChainChanged); 86 | }; 87 | } 88 | }, [handleAccountsChanged, handleChainChanged]); 89 | 90 | const connect = useCallback(async () => { 91 | if (window.ethereum) { 92 | try { 93 | const accounts = await window.ethereum.request({ 94 | method: "eth_requestAccounts", 95 | }); 96 | if (accounts.length === 0) { 97 | throw new Error("no accounts found"); 98 | } else { 99 | handleAccountsChanged(accounts); 100 | } 101 | } catch (err) { 102 | console.log("error occured while requesting accounts"); 103 | console.error(err); 104 | } 105 | } 106 | }, [handleAccountsChanged]); 107 | 108 | return ( 109 | 110 | {children} 111 | 112 | ); 113 | }; 114 | -------------------------------------------------------------------------------- /client/src/hooks/useProfile.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useState } from "react"; 3 | import { useContext } from "react"; 4 | 5 | const profileContext = React.createContext(); 6 | 7 | export const useProfile = () => { 8 | return useContext(profileContext); 9 | }; 10 | 11 | export function ProfileProvider({ children }) { 12 | const [profile, setProfile] = useState(null); 13 | const isRegistered = (() => { 14 | if (!profile) { 15 | return false; 16 | } else { 17 | if (profile.role === "NA") { 18 | return false; 19 | } else { 20 | return true; 21 | } 22 | } 23 | })(); 24 | console.debug("profile state changed"); 25 | console.debug({ profile, isRegistered }); 26 | 27 | return ( 28 | 29 | {children} 30 | 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import "./index.css"; 4 | import App from "./App"; 5 | import reportWebVitals from "./reportWebVitals"; 6 | import { MetamaskProvider } from "./hooks/useMetamask"; 7 | import { ProfileProvider } from "./hooks/useProfile"; 8 | import { ClientProvider } from "./hooks/useClient"; 9 | 10 | const root = ReactDOM.createRoot(document.getElementById("root")); 11 | root.render( 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ); 22 | 23 | // If you want to start measuring performance in your app, pass a function 24 | // to log results (for example: reportWebVitals(console.log)) 25 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 26 | reportWebVitals(); 27 | -------------------------------------------------------------------------------- /client/src/lib/EtherDocsClient.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | import { BrowserProvider ,Contract } from "ethers"; 3 | 4 | class EtherDocsClient { 5 | constructor() { 6 | //@ts-expect-error 7 | this.provider = new BrowserProvider(window.ethereum); 8 | 9 | // Get the user's account 10 | this.signer = null 11 | this.contract = null 12 | 13 | } 14 | 15 | async setup(abi, address){ 16 | this.signer = await this.provider.getSigner() 17 | this.contract = new Contract(address, abi, this.signer) 18 | } 19 | 20 | async isRegistered() { 21 | return await this.contract.connect(this.signer).isRegistered(); 22 | } 23 | 24 | async getProfile() { 25 | const res = await this.contract.connect(this.signer).getProfile(); 26 | return { 27 | address: res[0], 28 | name: res[1], 29 | role: res[2], 30 | }; 31 | } 32 | async getProfileByAddress(address) { 33 | const res = await this.contract.connect(this.signer).getProfileByAddress(address); 34 | return { 35 | address: res[0], 36 | name: res[1], 37 | role: res[2], 38 | }; 39 | } 40 | 41 | /** 42 | * @param {string} name 43 | */ 44 | async registerUser(name) { 45 | const tx = await this.contract.connect(this.signer).registerUser(name); 46 | await tx.wait(); 47 | console.log("user registered"); 48 | } 49 | 50 | /** 51 | * @param {string} name 52 | */ 53 | async registerIssuer(name) { 54 | const tx = await this.contract.connect(this.signer).registerIssuer(name); 55 | await tx.wait(); 56 | console.log("issuer registered"); 57 | } 58 | 59 | /** 60 | * @returns {Promise} 61 | */ 62 | async isUser() { 63 | return await this.contract.connect(this.signer).isUser(); 64 | } 65 | 66 | /** 67 | * @returns {Promise} 68 | */ 69 | async isIssuer() { 70 | return await this.contract.connect(this.signer).isIssuer(); 71 | } 72 | 73 | /** 74 | * @param {string} name 75 | * @param {string} userAddr 76 | * @param {string} uuid 77 | * @param {string} hashValue 78 | * @param {string} ipfsUrl 79 | * @returns 80 | */ 81 | async issueCertificate(name, userAddr, uuid, hashValue, ipfsUrl) { 82 | try { 83 | const tx = await this.contract 84 | .connect(this.signer) 85 | .issueCertificate(name, userAddr, uuid, hashValue, ipfsUrl); 86 | await tx.wait(); 87 | return true; 88 | } catch (err) { 89 | console.error(err); 90 | return false; 91 | } 92 | } 93 | 94 | /** 95 | * @param {string} uuid 96 | * @returns 97 | */ 98 | async invalidateCertificate(uuid) { 99 | try { 100 | const tx = await this.contract 101 | .connect(this.signer) 102 | .invalidateCertificate(uuid); 103 | await tx.wait(); 104 | return true; 105 | } catch (err) { 106 | console.error(err); 107 | return false; 108 | } 109 | } 110 | 111 | /** 112 | * @param {string} uuid 113 | */ 114 | async getCertificate(uuid) { 115 | try { 116 | const result = await this.contract 117 | .connect(this.signer) 118 | .getCertificate(uuid); 119 | return { 120 | name: result[0], 121 | issuerAddr: result[1], 122 | userAddr: result[2], 123 | uuid: result[3], 124 | ipfsUrl: result[4], 125 | isValid: result[5], 126 | }; 127 | } catch (err) { 128 | console.error(err); 129 | return null; 130 | } 131 | } 132 | 133 | /** 134 | * 135 | * @param {string} uuid 136 | * @param {string} issuerAddr 137 | * @param {string} userAddr 138 | * @param {string} hashValue 139 | * @returns 140 | */ 141 | async verifyCertificate(uuid, issuerAddr, userAddr, hashValue) { 142 | try { 143 | const result = await this.contract 144 | .connect(this.signer) 145 | .verifyCertificate(uuid, issuerAddr, userAddr, hashValue); 146 | return result; 147 | } catch (err) { 148 | console.error(err); 149 | return null; 150 | } 151 | } 152 | 153 | async getCertificatesIssuedFor() { 154 | try { 155 | const uuids = await this.contract 156 | .connect(this.signer) 157 | .getCertificatesIssuedFor(); 158 | return Promise.all( 159 | uuids.map((uuid) => { 160 | return this.getCertificate(uuid); 161 | }) 162 | ); 163 | } catch (err) { 164 | console.error(err); 165 | return null; 166 | } 167 | } 168 | 169 | async getCertificatesIssuedBy() { 170 | try { 171 | const uuids = await this.contract 172 | .connect(this.signer) 173 | .getCertificatesIssuedBy(); 174 | return Promise.all( 175 | uuids.map((uuid) => { 176 | return this.getCertificate(uuid); 177 | }) 178 | ); 179 | } catch (err) { 180 | console.error(err); 181 | return null; 182 | } 183 | } 184 | } 185 | 186 | export default EtherDocsClient; 187 | -------------------------------------------------------------------------------- /client/src/lib/Etherdocs.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "Etherdocs", 4 | "sourceName": "contracts/Etherdocs.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "stateMutability": "nonpayable", 9 | "type": "constructor" 10 | }, 11 | { 12 | "inputs": [ 13 | { 14 | "internalType": "string", 15 | "name": "_uuid", 16 | "type": "string" 17 | } 18 | ], 19 | "name": "getCertificate", 20 | "outputs": [ 21 | { 22 | "internalType": "string", 23 | "name": "", 24 | "type": "string" 25 | }, 26 | { 27 | "internalType": "address", 28 | "name": "", 29 | "type": "address" 30 | }, 31 | { 32 | "internalType": "address", 33 | "name": "", 34 | "type": "address" 35 | }, 36 | { 37 | "internalType": "string", 38 | "name": "", 39 | "type": "string" 40 | }, 41 | { 42 | "internalType": "string", 43 | "name": "", 44 | "type": "string" 45 | }, 46 | { 47 | "internalType": "bool", 48 | "name": "", 49 | "type": "bool" 50 | } 51 | ], 52 | "stateMutability": "view", 53 | "type": "function" 54 | }, 55 | { 56 | "inputs": [], 57 | "name": "getCertificatesIssuedBy", 58 | "outputs": [ 59 | { 60 | "internalType": "string[]", 61 | "name": "", 62 | "type": "string[]" 63 | } 64 | ], 65 | "stateMutability": "view", 66 | "type": "function" 67 | }, 68 | { 69 | "inputs": [], 70 | "name": "getCertificatesIssuedFor", 71 | "outputs": [ 72 | { 73 | "internalType": "string[]", 74 | "name": "", 75 | "type": "string[]" 76 | } 77 | ], 78 | "stateMutability": "view", 79 | "type": "function" 80 | }, 81 | { 82 | "inputs": [], 83 | "name": "getIssuedByCount", 84 | "outputs": [ 85 | { 86 | "internalType": "uint256", 87 | "name": "", 88 | "type": "uint256" 89 | } 90 | ], 91 | "stateMutability": "view", 92 | "type": "function" 93 | }, 94 | { 95 | "inputs": [], 96 | "name": "getIssuedForCount", 97 | "outputs": [ 98 | { 99 | "internalType": "uint256", 100 | "name": "", 101 | "type": "uint256" 102 | } 103 | ], 104 | "stateMutability": "view", 105 | "type": "function" 106 | }, 107 | { 108 | "inputs": [], 109 | "name": "getProfile", 110 | "outputs": [ 111 | { 112 | "internalType": "address", 113 | "name": "", 114 | "type": "address" 115 | }, 116 | { 117 | "internalType": "string", 118 | "name": "", 119 | "type": "string" 120 | }, 121 | { 122 | "internalType": "string", 123 | "name": "", 124 | "type": "string" 125 | } 126 | ], 127 | "stateMutability": "view", 128 | "type": "function" 129 | }, 130 | { 131 | "inputs": [ 132 | { 133 | "internalType": "address", 134 | "name": "_address", 135 | "type": "address" 136 | } 137 | ], 138 | "name": "getProfileByAddress", 139 | "outputs": [ 140 | { 141 | "internalType": "address", 142 | "name": "", 143 | "type": "address" 144 | }, 145 | { 146 | "internalType": "string", 147 | "name": "", 148 | "type": "string" 149 | }, 150 | { 151 | "internalType": "string", 152 | "name": "", 153 | "type": "string" 154 | } 155 | ], 156 | "stateMutability": "view", 157 | "type": "function" 158 | }, 159 | { 160 | "inputs": [ 161 | { 162 | "internalType": "string", 163 | "name": "_uuid", 164 | "type": "string" 165 | } 166 | ], 167 | "name": "invalidateCertificate", 168 | "outputs": [], 169 | "stateMutability": "nonpayable", 170 | "type": "function" 171 | }, 172 | { 173 | "inputs": [], 174 | "name": "isIssuer", 175 | "outputs": [ 176 | { 177 | "internalType": "bool", 178 | "name": "", 179 | "type": "bool" 180 | } 181 | ], 182 | "stateMutability": "view", 183 | "type": "function" 184 | }, 185 | { 186 | "inputs": [], 187 | "name": "isRegistered", 188 | "outputs": [ 189 | { 190 | "internalType": "bool", 191 | "name": "", 192 | "type": "bool" 193 | } 194 | ], 195 | "stateMutability": "view", 196 | "type": "function" 197 | }, 198 | { 199 | "inputs": [], 200 | "name": "isUser", 201 | "outputs": [ 202 | { 203 | "internalType": "bool", 204 | "name": "", 205 | "type": "bool" 206 | } 207 | ], 208 | "stateMutability": "view", 209 | "type": "function" 210 | }, 211 | { 212 | "inputs": [ 213 | { 214 | "internalType": "string", 215 | "name": "_name", 216 | "type": "string" 217 | }, 218 | { 219 | "internalType": "address", 220 | "name": "_userAddr", 221 | "type": "address" 222 | }, 223 | { 224 | "internalType": "string", 225 | "name": "_uuid", 226 | "type": "string" 227 | }, 228 | { 229 | "internalType": "string", 230 | "name": "_hashValue", 231 | "type": "string" 232 | }, 233 | { 234 | "internalType": "string", 235 | "name": "_ipfsUrl", 236 | "type": "string" 237 | } 238 | ], 239 | "name": "issueCertificate", 240 | "outputs": [], 241 | "stateMutability": "nonpayable", 242 | "type": "function" 243 | }, 244 | { 245 | "inputs": [ 246 | { 247 | "internalType": "string", 248 | "name": "_name", 249 | "type": "string" 250 | } 251 | ], 252 | "name": "registerIssuer", 253 | "outputs": [], 254 | "stateMutability": "nonpayable", 255 | "type": "function" 256 | }, 257 | { 258 | "inputs": [ 259 | { 260 | "internalType": "string", 261 | "name": "_name", 262 | "type": "string" 263 | } 264 | ], 265 | "name": "registerUser", 266 | "outputs": [], 267 | "stateMutability": "nonpayable", 268 | "type": "function" 269 | }, 270 | { 271 | "inputs": [ 272 | { 273 | "internalType": "string", 274 | "name": "_uuid", 275 | "type": "string" 276 | }, 277 | { 278 | "internalType": "address", 279 | "name": "_issuerAddr", 280 | "type": "address" 281 | }, 282 | { 283 | "internalType": "address", 284 | "name": "_userAddr", 285 | "type": "address" 286 | }, 287 | { 288 | "internalType": "string", 289 | "name": "_hashValue", 290 | "type": "string" 291 | } 292 | ], 293 | "name": "verifyCertificate", 294 | "outputs": [ 295 | { 296 | "internalType": "bool", 297 | "name": "", 298 | "type": "bool" 299 | } 300 | ], 301 | "stateMutability": "view", 302 | "type": "function" 303 | } 304 | ], 305 | "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506139ce806100606000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80634cd6959c1161009757806386af78fa1161006657806386af78fa14610262578063cfa026da14610280578063d6afc9b11461029e578063ed0f2e75146102be576100f5565b80634cd6959c146101dc5780635b1146bd1461020e5780636f4581dc1461022a578063704f1b9414610246576100f5565b806322366844116100d3578063223668441461016657806324f349f914610184578063455a04ab146101a05780634c22c119146101be576100f5565b806306982546146100fa5780630a660bc01461012a5780630ae380ed14610148575b600080fd5b610114600480360381019061010f9190612b76565b6102f3565b6040516101219190612c30565b60405180910390f35b6101326104bb565b60405161013f9190612c64565b60405180910390f35b6101506104cb565b60405161015d9190612c64565b60405180910390f35b61016e6104db565b60405161017b9190612c30565b60405180910390f35b61019e60048036038101906101999190612c7f565b6104f0565b005b6101a861061d565b6040516101b59190612e09565b60405180910390f35b6101c661062d565b6040516101d39190612c30565b60405180910390f35b6101f660048036038101906101f19190612e2b565b610642565b60405161020593929190612eb1565b60405180910390f35b61022860048036038101906102239190612ef6565b610a6c565b005b610244600480360381019061023f9190612c7f565b610cec565b005b610260600480360381019061025b9190612c7f565b610eb5565b005b61026a61107e565b6040516102779190612c30565b60405180910390f35b610288611093565b6040516102959190612e09565b60405180910390f35b6102a66110a3565b6040516102b593929190612eb1565b60405180910390f35b6102d860048036038101906102d39190612c7f565b6114cb565b6040516102ea96959493929190612fe1565b60405180910390f35b6000806005866040516103069190613093565b908152602001604051809103902090508060060160019054906101000a900460ff16158061034357508060060160009054906101000a900460ff16155b156103525760009150506104b3565b8473ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614801561040057508373ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b801561049e575061049d816004018054610419906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054610445906130d9565b80156104925780601f1061046757610100808354040283529160200191610492565b820191906000526020600020905b81548152906001019060200180831161047557829003601f168201915b505050505084611718565b5b156104ad5760019150506104b3565b60009150505b949350505050565b60006104c633611771565b905090565b60006104d633611b61565b905090565b6000803390506104ea81611f51565b91505090565b60006005826040516105029190613093565b90815260200160405180910390209050600115158160060160009054906101000a900460ff1615151461056a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056190613156565b60405180910390fd5b8060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f3906131e8565b60405180910390fd5b60008160060160016101000a81548160ff0219169083151502179055505050565b606061062833612022565b905090565b60008033905061063c81612492565b91505090565b6000606080600084905061065581611f51565b6106d257806040518060400160405280600281526020017f4e410000000000000000000000000000000000000000000000000000000000008152506040518060400160405280600281526020017f4e4100000000000000000000000000000000000000000000000000000000000081525093509350935050610a65565b6106db81612492565b1561087e576000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052908160008201805461073c906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054610768906130d9565b80156107b55780601f1061078a576101008083540402835291602001916107b5565b820191906000526020600020905b81548152906001019060200180831161079857829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff1615151515815250509050806020015181600001516040518060400160405280600481526020017f55736572000000000000000000000000000000000000000000000000000000008152509450945094505050610a65565b610887816124f0565b15610a2a576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060600160405290816000820180546108e8906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054610914906130d9565b80156109615780601f1061093657610100808354040283529160200191610961565b820191906000526020600020905b81548152906001019060200180831161094457829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff1615151515815250509050806020015181600001516040518060400160405280600681526020017f49737375657200000000000000000000000000000000000000000000000000008152509450945094505050610a65565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5c90613254565b60405180910390fd5b9193909250565b60011515610a79336124f0565b151514610abb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab2906132e6565b60405180910390fd5b60011515610ac885612492565b151514610b0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0190613378565b60405180910390fd5b60001515600584604051610b1e9190613093565b908152602001604051809103902060060160009054906101000a900460ff16151514610b7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b769061340a565b60405180910390fd5b60003390506000600585604051610b969190613093565b9081526020016040518091039020905060018160060160006101000a81548160ff02191690831515021790555086816000019081610bd491906135d6565b50818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550858160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084816003019081610c6c91906135d6565b5083816004019081610c7e91906135d6565b5082816005019081610c9091906135d6565b5060018160060160016101000a81548160ff021916908315150217905550600685908060018154018082558091505060019003906000526020600020016000909190919091509081610ce291906135d6565b5050505050505050565b60003390506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600015158160010160149054906101000a900460ff16151514610d8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d83906136f4565b60405180910390fd5b60001515610d9983612492565b151514610ddb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd290613760565b60405180910390fd5b818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018160010160146101000a81548160ff02191690831515021790555082816000019081610e4c91906135d6565b506002829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60003390506000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600015158160010160149054906101000a900460ff16151514610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c906137cc565b60405180910390fd5b60001515610f62836124f0565b151514610fa4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9b90613838565b60405180910390fd5b818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018160010160146101000a81548160ff0219169083151502179055508281600001908161101591906135d6565b506004829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60008033905061108d816124f0565b91505090565b606061109e3361254e565b905090565b600060608060003390506110b681611f51565b61113357806040518060400160405280600281526020017f4e410000000000000000000000000000000000000000000000000000000000008152506040518060400160405280600281526020017f4e41000000000000000000000000000000000000000000000000000000000000815250935093509350506114c6565b61113c81612492565b156112df576000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052908160008201805461119d906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546111c9906130d9565b80156112165780601f106111eb57610100808354040283529160200191611216565b820191906000526020600020905b8154815290600101906020018083116111f957829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff1615151515815250509050806020015181600001516040518060400160405280600481526020017f557365720000000000000000000000000000000000000000000000000000000081525094509450945050506114c6565b6112e8816124f0565b1561148b576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020604051806060016040529081600082018054611349906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611375906130d9565b80156113c25780601f10611397576101008083540402835291602001916113c2565b820191906000526020600020905b8154815290600101906020018083116113a557829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff1615151515815250509050806020015181600001516040518060400160405280600681526020017f497373756572000000000000000000000000000000000000000000000000000081525094509450945050506114c6565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bd90613254565b60405180910390fd5b909192565b60606000806060806000806005886040516114e69190613093565b90815260200160405180910390209050806000018160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168260020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683600301846005018560060160019054906101000a900460ff1685805461156a906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611596906130d9565b80156115e35780601f106115b8576101008083540402835291602001916115e3565b820191906000526020600020905b8154815290600101906020018083116115c657829003601f168201915b505050505095508280546115f6906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611622906130d9565b801561166f5780601f106116445761010080835404028352916020019161166f565b820191906000526020600020905b81548152906001019060200180831161165257829003601f168201915b50505050509250818054611682906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546116ae906130d9565b80156116fb5780601f106116d0576101008083540402835291602001916116fb565b820191906000526020600020905b8154815290600101906020018083116116de57829003601f168201915b505050505091509650965096509650965096505091939550919395565b60008160405160200161172b9190613093565b60405160208183030381529060405280519060200120836040516020016117529190613093565b6040516020818303038152906040528051906020012014905092915050565b6000806000905060005b600680549050811015611b575760006005600683815481106117a05761179f613858565b5b906000526020600020016040516117b7919061390a565b9081526020016040518091039020604051806101000160405290816000820180546117e1906130d9565b80601f016020809104026020016040519081016040528092919081815260200182805461180d906130d9565b801561185a5780601f1061182f5761010080835404028352916020019161185a565b820191906000526020600020905b81548152906001019060200180831161183d57829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201805461191f906130d9565b80601f016020809104026020016040519081016040528092919081815260200182805461194b906130d9565b80156119985780601f1061196d57610100808354040283529160200191611998565b820191906000526020600020905b81548152906001019060200180831161197b57829003601f168201915b505050505081526020016004820180546119b1906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546119dd906130d9565b8015611a2a5780601f106119ff57610100808354040283529160200191611a2a565b820191906000526020600020905b815481529060010190602001808311611a0d57829003601f168201915b50505050508152602001600582018054611a43906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611a6f906130d9565b8015611abc5780601f10611a9157610100808354040283529160200191611abc565b820191906000526020600020905b815481529060010190602001808311611a9f57829003601f168201915b505050505081526020016006820160009054906101000a900460ff161515151581526020016006820160019054906101000a900460ff16151515158152505090508473ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff1603611b43578280611b3f90613950565b9350505b508080611b4f90613950565b91505061177b565b5080915050919050565b6000806000905060005b600680549050811015611f47576000600560068381548110611b9057611b8f613858565b5b90600052602060002001604051611ba7919061390a565b908152602001604051809103902060405180610100016040529081600082018054611bd1906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611bfd906130d9565b8015611c4a5780601f10611c1f57610100808354040283529160200191611c4a565b820191906000526020600020905b815481529060010190602001808311611c2d57829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382018054611d0f906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611d3b906130d9565b8015611d885780601f10611d5d57610100808354040283529160200191611d88565b820191906000526020600020905b815481529060010190602001808311611d6b57829003601f168201915b50505050508152602001600482018054611da1906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611dcd906130d9565b8015611e1a5780601f10611def57610100808354040283529160200191611e1a565b820191906000526020600020905b815481529060010190602001808311611dfd57829003601f168201915b50505050508152602001600582018054611e33906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611e5f906130d9565b8015611eac5780601f10611e8157610100808354040283529160200191611eac565b820191906000526020600020905b815481529060010190602001808311611e8f57829003601f168201915b505050505081526020016006820160009054906101000a900460ff161515151581526020016006820160019054906101000a900460ff16151515158152505090508473ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff1603611f33578280611f2f90613950565b9350505b508080611f3f90613950565b915050611b6b565b5080915050919050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160149054906101000a900460ff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160149054906101000a900460ff16905081158015612006575080155b156120165760009250505061201d565b6001925050505b919050565b6060600061202f83611771565b905060008167ffffffffffffffff81111561204d5761204c6129ed565b5b60405190808252806020026020018201604052801561208057816020015b606081526020019060019003908161206b5790505b5090506000805b6006805490508110156124865760006005600683815481106120ac576120ab613858565b5b906000526020600020016040516120c3919061390a565b9081526020016040518091039020604051806101000160405290816000820180546120ed906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612119906130d9565b80156121665780601f1061213b57610100808354040283529160200191612166565b820191906000526020600020905b81548152906001019060200180831161214957829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201805461222b906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612257906130d9565b80156122a45780601f10612279576101008083540402835291602001916122a4565b820191906000526020600020905b81548152906001019060200180831161228757829003601f168201915b505050505081526020016004820180546122bd906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546122e9906130d9565b80156123365780601f1061230b57610100808354040283529160200191612336565b820191906000526020600020905b81548152906001019060200180831161231957829003601f168201915b5050505050815260200160058201805461234f906130d9565b80601f016020809104026020016040519081016040528092919081815260200182805461237b906130d9565b80156123c85780601f1061239d576101008083540402835291602001916123c8565b820191906000526020600020905b8154815290600101906020018083116123ab57829003601f168201915b505050505081526020016006820160009054906101000a900460ff161515151581526020016006820160019054906101000a900460ff16151515158152505090508673ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff160361247257806060015184848151811061245857612457613858565b5b6020026020010181905250828061246e90613950565b9350505b50808061247e90613950565b915050612087565b50819350505050919050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160149054906101000a900460ff16905080915050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160149054906101000a900460ff16905080915050919050565b6060600061255b83611b61565b905060008167ffffffffffffffff811115612579576125786129ed565b5b6040519080825280602002602001820160405280156125ac57816020015b60608152602001906001900390816125975790505b5090506000805b6006805490508110156129b25760006005600683815481106125d8576125d7613858565b5b906000526020600020016040516125ef919061390a565b908152602001604051809103902060405180610100016040529081600082018054612619906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612645906130d9565b80156126925780601f1061266757610100808354040283529160200191612692565b820191906000526020600020905b81548152906001019060200180831161267557829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382018054612757906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612783906130d9565b80156127d05780601f106127a5576101008083540402835291602001916127d0565b820191906000526020600020905b8154815290600101906020018083116127b357829003601f168201915b505050505081526020016004820180546127e9906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612815906130d9565b80156128625780601f1061283757610100808354040283529160200191612862565b820191906000526020600020905b81548152906001019060200180831161284557829003601f168201915b5050505050815260200160058201805461287b906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546128a7906130d9565b80156128f45780601f106128c9576101008083540402835291602001916128f4565b820191906000526020600020905b8154815290600101906020018083116128d757829003601f168201915b505050505081526020016006820160009054906101000a900460ff161515151581526020016006820160019054906101000a900460ff16151515158152505090508673ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff160361299e57806060015184848151811061298457612983613858565b5b6020026020010181905250828061299a90613950565b9350505b5080806129aa90613950565b9150506125b3565b50819350505050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612a25826129dc565b810181811067ffffffffffffffff82111715612a4457612a436129ed565b5b80604052505050565b6000612a576129be565b9050612a638282612a1c565b919050565b600067ffffffffffffffff821115612a8357612a826129ed565b5b612a8c826129dc565b9050602081019050919050565b82818337600083830152505050565b6000612abb612ab684612a68565b612a4d565b905082815260208101848484011115612ad757612ad66129d7565b5b612ae2848285612a99565b509392505050565b600082601f830112612aff57612afe6129d2565b5b8135612b0f848260208601612aa8565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612b4382612b18565b9050919050565b612b5381612b38565b8114612b5e57600080fd5b50565b600081359050612b7081612b4a565b92915050565b60008060008060808587031215612b9057612b8f6129c8565b5b600085013567ffffffffffffffff811115612bae57612bad6129cd565b5b612bba87828801612aea565b9450506020612bcb87828801612b61565b9350506040612bdc87828801612b61565b925050606085013567ffffffffffffffff811115612bfd57612bfc6129cd565b5b612c0987828801612aea565b91505092959194509250565b60008115159050919050565b612c2a81612c15565b82525050565b6000602082019050612c456000830184612c21565b92915050565b6000819050919050565b612c5e81612c4b565b82525050565b6000602082019050612c796000830184612c55565b92915050565b600060208284031215612c9557612c946129c8565b5b600082013567ffffffffffffffff811115612cb357612cb26129cd565b5b612cbf84828501612aea565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612d2e578082015181840152602081019050612d13565b60008484015250505050565b6000612d4582612cf4565b612d4f8185612cff565b9350612d5f818560208601612d10565b612d68816129dc565b840191505092915050565b6000612d7f8383612d3a565b905092915050565b6000602082019050919050565b6000612d9f82612cc8565b612da98185612cd3565b935083602082028501612dbb85612ce4565b8060005b85811015612df75784840389528151612dd88582612d73565b9450612de383612d87565b925060208a01995050600181019050612dbf565b50829750879550505050505092915050565b60006020820190508181036000830152612e238184612d94565b905092915050565b600060208284031215612e4157612e406129c8565b5b6000612e4f84828501612b61565b91505092915050565b612e6181612b38565b82525050565b600082825260208201905092915050565b6000612e8382612cf4565b612e8d8185612e67565b9350612e9d818560208601612d10565b612ea6816129dc565b840191505092915050565b6000606082019050612ec66000830186612e58565b8181036020830152612ed88185612e78565b90508181036040830152612eec8184612e78565b9050949350505050565b600080600080600060a08688031215612f1257612f116129c8565b5b600086013567ffffffffffffffff811115612f3057612f2f6129cd565b5b612f3c88828901612aea565b9550506020612f4d88828901612b61565b945050604086013567ffffffffffffffff811115612f6e57612f6d6129cd565b5b612f7a88828901612aea565b935050606086013567ffffffffffffffff811115612f9b57612f9a6129cd565b5b612fa788828901612aea565b925050608086013567ffffffffffffffff811115612fc857612fc76129cd565b5b612fd488828901612aea565b9150509295509295909350565b600060c0820190508181036000830152612ffb8189612e78565b905061300a6020830188612e58565b6130176040830187612e58565b81810360608301526130298186612e78565b9050818103608083015261303d8185612e78565b905061304c60a0830184612c21565b979650505050505050565b600081905092915050565b600061306d82612cf4565b6130778185613057565b9350613087818560208601612d10565b80840191505092915050565b600061309f8284613062565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806130f157607f821691505b602082108103613104576131036130aa565b5b50919050565b7f696e76616c696465206365727469666963617465207575696400000000000000600082015250565b6000613140601983612e67565b915061314b8261310a565b602082019050919050565b6000602082019050818103600083015261316f81613133565b9050919050565b7f6f6e6c79206973737565722063616e20696e76616c696461746520636572746960008201527f6669636174650000000000000000000000000000000000000000000000000000602082015250565b60006131d2602683612e67565b91506131dd82613176565b604082019050919050565b60006020820190508181036000830152613201816131c5565b9050919050565b7f696e76616c696420726f6c650000000000000000000000000000000000000000600082015250565b600061323e600c83612e67565b915061324982613208565b602082019050919050565b6000602082019050818103600083015261326d81613231565b9050919050565b7f6f6e6c79206973737565722063616e206973737565206365727469666963617460008201527f6573000000000000000000000000000000000000000000000000000000000000602082015250565b60006132d0602283612e67565b91506132db82613274565b604082019050919050565b600060208201905081810360008301526132ff816132c3565b9050919050565b7f63657274696669636174652063616e2062652069737375656420746f2075736560008201527f7273206f6e6c7900000000000000000000000000000000000000000000000000602082015250565b6000613362602783612e67565b915061336d82613306565b604082019050919050565b6000602082019050818103600083015261339181613355565b9050919050565b7f636572746966696361746520776974682073616d65207575696420616c72656160008201527f6479207265676973746572656400000000000000000000000000000000000000602082015250565b60006133f4602d83612e67565b91506133ff82613398565b604082019050919050565b60006020820190508181036000830152613423816133e7565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261348c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261344f565b613496868361344f565b95508019841693508086168417925050509392505050565b6000819050919050565b60006134d36134ce6134c984612c4b565b6134ae565b612c4b565b9050919050565b6000819050919050565b6134ed836134b8565b6135016134f9826134da565b84845461345c565b825550505050565b600090565b613516613509565b6135218184846134e4565b505050565b5b818110156135455761353a60008261350e565b600181019050613527565b5050565b601f82111561358a5761355b8161342a565b6135648461343f565b81016020851015613573578190505b61358761357f8561343f565b830182613526565b50505b505050565b600082821c905092915050565b60006135ad6000198460080261358f565b1980831691505092915050565b60006135c6838361359c565b9150826002028217905092915050565b6135df82612cf4565b67ffffffffffffffff8111156135f8576135f76129ed565b5b61360282546130d9565b61360d828285613549565b600060209050601f831160018114613640576000841561362e578287015190505b61363885826135ba565b8655506136a0565b601f19841661364e8661342a565b60005b8281101561367657848901518255600182019150602085019450602081019050613651565b86831015613693578489015161368f601f89168261359c565b8355505b6001600288020188555050505b505050505050565b7f69737375657220616c7265616479207265676973746572656400000000000000600082015250565b60006136de601983612e67565b91506136e9826136a8565b602082019050919050565b6000602082019050818103600083015261370d816136d1565b9050919050565b7f616c726561647920726567697374657265642061732075736572000000000000600082015250565b600061374a601a83612e67565b915061375582613714565b602082019050919050565b600060208201905081810360008301526137798161373d565b9050919050565b7f7573657220616c72656164792072656769737465726564000000000000000000600082015250565b60006137b6601783612e67565b91506137c182613780565b602082019050919050565b600060208201905081810360008301526137e5816137a9565b9050919050565b7f616c726561647920726567697374657265642061732069737375657200000000600082015250565b6000613822601c83612e67565b915061382d826137ec565b602082019050919050565b6000602082019050818103600083015261385181613815565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008154613894816130d9565b61389e8186613057565b945060018216600081146138b957600181146138ce57613901565b60ff1983168652811515820286019350613901565b6138d78561342a565b60005b838110156138f9578154818901526001820191506020810190506138da565b838801955050505b50505092915050565b60006139168284613887565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061395b82612c4b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361398d5761398c613921565b5b60018201905091905056fea26469706673582212208e81303d448ac70d3191c98c5f3b6575c8b516b6a015d068852c540cede8ec5664736f6c63430008110033", 306 | "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80634cd6959c1161009757806386af78fa1161006657806386af78fa14610262578063cfa026da14610280578063d6afc9b11461029e578063ed0f2e75146102be576100f5565b80634cd6959c146101dc5780635b1146bd1461020e5780636f4581dc1461022a578063704f1b9414610246576100f5565b806322366844116100d3578063223668441461016657806324f349f914610184578063455a04ab146101a05780634c22c119146101be576100f5565b806306982546146100fa5780630a660bc01461012a5780630ae380ed14610148575b600080fd5b610114600480360381019061010f9190612b76565b6102f3565b6040516101219190612c30565b60405180910390f35b6101326104bb565b60405161013f9190612c64565b60405180910390f35b6101506104cb565b60405161015d9190612c64565b60405180910390f35b61016e6104db565b60405161017b9190612c30565b60405180910390f35b61019e60048036038101906101999190612c7f565b6104f0565b005b6101a861061d565b6040516101b59190612e09565b60405180910390f35b6101c661062d565b6040516101d39190612c30565b60405180910390f35b6101f660048036038101906101f19190612e2b565b610642565b60405161020593929190612eb1565b60405180910390f35b61022860048036038101906102239190612ef6565b610a6c565b005b610244600480360381019061023f9190612c7f565b610cec565b005b610260600480360381019061025b9190612c7f565b610eb5565b005b61026a61107e565b6040516102779190612c30565b60405180910390f35b610288611093565b6040516102959190612e09565b60405180910390f35b6102a66110a3565b6040516102b593929190612eb1565b60405180910390f35b6102d860048036038101906102d39190612c7f565b6114cb565b6040516102ea96959493929190612fe1565b60405180910390f35b6000806005866040516103069190613093565b908152602001604051809103902090508060060160019054906101000a900460ff16158061034357508060060160009054906101000a900460ff16155b156103525760009150506104b3565b8473ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614801561040057508373ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b801561049e575061049d816004018054610419906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054610445906130d9565b80156104925780601f1061046757610100808354040283529160200191610492565b820191906000526020600020905b81548152906001019060200180831161047557829003601f168201915b505050505084611718565b5b156104ad5760019150506104b3565b60009150505b949350505050565b60006104c633611771565b905090565b60006104d633611b61565b905090565b6000803390506104ea81611f51565b91505090565b60006005826040516105029190613093565b90815260200160405180910390209050600115158160060160009054906101000a900460ff1615151461056a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056190613156565b60405180910390fd5b8060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f3906131e8565b60405180910390fd5b60008160060160016101000a81548160ff0219169083151502179055505050565b606061062833612022565b905090565b60008033905061063c81612492565b91505090565b6000606080600084905061065581611f51565b6106d257806040518060400160405280600281526020017f4e410000000000000000000000000000000000000000000000000000000000008152506040518060400160405280600281526020017f4e4100000000000000000000000000000000000000000000000000000000000081525093509350935050610a65565b6106db81612492565b1561087e576000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052908160008201805461073c906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054610768906130d9565b80156107b55780601f1061078a576101008083540402835291602001916107b5565b820191906000526020600020905b81548152906001019060200180831161079857829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff1615151515815250509050806020015181600001516040518060400160405280600481526020017f55736572000000000000000000000000000000000000000000000000000000008152509450945094505050610a65565b610887816124f0565b15610a2a576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060600160405290816000820180546108e8906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054610914906130d9565b80156109615780601f1061093657610100808354040283529160200191610961565b820191906000526020600020905b81548152906001019060200180831161094457829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff1615151515815250509050806020015181600001516040518060400160405280600681526020017f49737375657200000000000000000000000000000000000000000000000000008152509450945094505050610a65565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5c90613254565b60405180910390fd5b9193909250565b60011515610a79336124f0565b151514610abb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab2906132e6565b60405180910390fd5b60011515610ac885612492565b151514610b0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0190613378565b60405180910390fd5b60001515600584604051610b1e9190613093565b908152602001604051809103902060060160009054906101000a900460ff16151514610b7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b769061340a565b60405180910390fd5b60003390506000600585604051610b969190613093565b9081526020016040518091039020905060018160060160006101000a81548160ff02191690831515021790555086816000019081610bd491906135d6565b50818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550858160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084816003019081610c6c91906135d6565b5083816004019081610c7e91906135d6565b5082816005019081610c9091906135d6565b5060018160060160016101000a81548160ff021916908315150217905550600685908060018154018082558091505060019003906000526020600020016000909190919091509081610ce291906135d6565b5050505050505050565b60003390506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600015158160010160149054906101000a900460ff16151514610d8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d83906136f4565b60405180910390fd5b60001515610d9983612492565b151514610ddb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd290613760565b60405180910390fd5b818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018160010160146101000a81548160ff02191690831515021790555082816000019081610e4c91906135d6565b506002829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60003390506000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600015158160010160149054906101000a900460ff16151514610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c906137cc565b60405180910390fd5b60001515610f62836124f0565b151514610fa4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9b90613838565b60405180910390fd5b818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018160010160146101000a81548160ff0219169083151502179055508281600001908161101591906135d6565b506004829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60008033905061108d816124f0565b91505090565b606061109e3361254e565b905090565b600060608060003390506110b681611f51565b61113357806040518060400160405280600281526020017f4e410000000000000000000000000000000000000000000000000000000000008152506040518060400160405280600281526020017f4e41000000000000000000000000000000000000000000000000000000000000815250935093509350506114c6565b61113c81612492565b156112df576000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052908160008201805461119d906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546111c9906130d9565b80156112165780601f106111eb57610100808354040283529160200191611216565b820191906000526020600020905b8154815290600101906020018083116111f957829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff1615151515815250509050806020015181600001516040518060400160405280600481526020017f557365720000000000000000000000000000000000000000000000000000000081525094509450945050506114c6565b6112e8816124f0565b1561148b576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020604051806060016040529081600082018054611349906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611375906130d9565b80156113c25780601f10611397576101008083540402835291602001916113c2565b820191906000526020600020905b8154815290600101906020018083116113a557829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff1615151515815250509050806020015181600001516040518060400160405280600681526020017f497373756572000000000000000000000000000000000000000000000000000081525094509450945050506114c6565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bd90613254565b60405180910390fd5b909192565b60606000806060806000806005886040516114e69190613093565b90815260200160405180910390209050806000018160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168260020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683600301846005018560060160019054906101000a900460ff1685805461156a906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611596906130d9565b80156115e35780601f106115b8576101008083540402835291602001916115e3565b820191906000526020600020905b8154815290600101906020018083116115c657829003601f168201915b505050505095508280546115f6906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611622906130d9565b801561166f5780601f106116445761010080835404028352916020019161166f565b820191906000526020600020905b81548152906001019060200180831161165257829003601f168201915b50505050509250818054611682906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546116ae906130d9565b80156116fb5780601f106116d0576101008083540402835291602001916116fb565b820191906000526020600020905b8154815290600101906020018083116116de57829003601f168201915b505050505091509650965096509650965096505091939550919395565b60008160405160200161172b9190613093565b60405160208183030381529060405280519060200120836040516020016117529190613093565b6040516020818303038152906040528051906020012014905092915050565b6000806000905060005b600680549050811015611b575760006005600683815481106117a05761179f613858565b5b906000526020600020016040516117b7919061390a565b9081526020016040518091039020604051806101000160405290816000820180546117e1906130d9565b80601f016020809104026020016040519081016040528092919081815260200182805461180d906130d9565b801561185a5780601f1061182f5761010080835404028352916020019161185a565b820191906000526020600020905b81548152906001019060200180831161183d57829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201805461191f906130d9565b80601f016020809104026020016040519081016040528092919081815260200182805461194b906130d9565b80156119985780601f1061196d57610100808354040283529160200191611998565b820191906000526020600020905b81548152906001019060200180831161197b57829003601f168201915b505050505081526020016004820180546119b1906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546119dd906130d9565b8015611a2a5780601f106119ff57610100808354040283529160200191611a2a565b820191906000526020600020905b815481529060010190602001808311611a0d57829003601f168201915b50505050508152602001600582018054611a43906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611a6f906130d9565b8015611abc5780601f10611a9157610100808354040283529160200191611abc565b820191906000526020600020905b815481529060010190602001808311611a9f57829003601f168201915b505050505081526020016006820160009054906101000a900460ff161515151581526020016006820160019054906101000a900460ff16151515158152505090508473ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff1603611b43578280611b3f90613950565b9350505b508080611b4f90613950565b91505061177b565b5080915050919050565b6000806000905060005b600680549050811015611f47576000600560068381548110611b9057611b8f613858565b5b90600052602060002001604051611ba7919061390a565b908152602001604051809103902060405180610100016040529081600082018054611bd1906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611bfd906130d9565b8015611c4a5780601f10611c1f57610100808354040283529160200191611c4a565b820191906000526020600020905b815481529060010190602001808311611c2d57829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382018054611d0f906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611d3b906130d9565b8015611d885780601f10611d5d57610100808354040283529160200191611d88565b820191906000526020600020905b815481529060010190602001808311611d6b57829003601f168201915b50505050508152602001600482018054611da1906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611dcd906130d9565b8015611e1a5780601f10611def57610100808354040283529160200191611e1a565b820191906000526020600020905b815481529060010190602001808311611dfd57829003601f168201915b50505050508152602001600582018054611e33906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054611e5f906130d9565b8015611eac5780601f10611e8157610100808354040283529160200191611eac565b820191906000526020600020905b815481529060010190602001808311611e8f57829003601f168201915b505050505081526020016006820160009054906101000a900460ff161515151581526020016006820160019054906101000a900460ff16151515158152505090508473ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff1603611f33578280611f2f90613950565b9350505b508080611f3f90613950565b915050611b6b565b5080915050919050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160149054906101000a900460ff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160149054906101000a900460ff16905081158015612006575080155b156120165760009250505061201d565b6001925050505b919050565b6060600061202f83611771565b905060008167ffffffffffffffff81111561204d5761204c6129ed565b5b60405190808252806020026020018201604052801561208057816020015b606081526020019060019003908161206b5790505b5090506000805b6006805490508110156124865760006005600683815481106120ac576120ab613858565b5b906000526020600020016040516120c3919061390a565b9081526020016040518091039020604051806101000160405290816000820180546120ed906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612119906130d9565b80156121665780601f1061213b57610100808354040283529160200191612166565b820191906000526020600020905b81548152906001019060200180831161214957829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201805461222b906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612257906130d9565b80156122a45780601f10612279576101008083540402835291602001916122a4565b820191906000526020600020905b81548152906001019060200180831161228757829003601f168201915b505050505081526020016004820180546122bd906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546122e9906130d9565b80156123365780601f1061230b57610100808354040283529160200191612336565b820191906000526020600020905b81548152906001019060200180831161231957829003601f168201915b5050505050815260200160058201805461234f906130d9565b80601f016020809104026020016040519081016040528092919081815260200182805461237b906130d9565b80156123c85780601f1061239d576101008083540402835291602001916123c8565b820191906000526020600020905b8154815290600101906020018083116123ab57829003601f168201915b505050505081526020016006820160009054906101000a900460ff161515151581526020016006820160019054906101000a900460ff16151515158152505090508673ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff160361247257806060015184848151811061245857612457613858565b5b6020026020010181905250828061246e90613950565b9350505b50808061247e90613950565b915050612087565b50819350505050919050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160149054906101000a900460ff16905080915050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160149054906101000a900460ff16905080915050919050565b6060600061255b83611b61565b905060008167ffffffffffffffff811115612579576125786129ed565b5b6040519080825280602002602001820160405280156125ac57816020015b60608152602001906001900390816125975790505b5090506000805b6006805490508110156129b25760006005600683815481106125d8576125d7613858565b5b906000526020600020016040516125ef919061390a565b908152602001604051809103902060405180610100016040529081600082018054612619906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612645906130d9565b80156126925780601f1061266757610100808354040283529160200191612692565b820191906000526020600020905b81548152906001019060200180831161267557829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382018054612757906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612783906130d9565b80156127d05780601f106127a5576101008083540402835291602001916127d0565b820191906000526020600020905b8154815290600101906020018083116127b357829003601f168201915b505050505081526020016004820180546127e9906130d9565b80601f0160208091040260200160405190810160405280929190818152602001828054612815906130d9565b80156128625780601f1061283757610100808354040283529160200191612862565b820191906000526020600020905b81548152906001019060200180831161284557829003601f168201915b5050505050815260200160058201805461287b906130d9565b80601f01602080910402602001604051908101604052809291908181526020018280546128a7906130d9565b80156128f45780601f106128c9576101008083540402835291602001916128f4565b820191906000526020600020905b8154815290600101906020018083116128d757829003601f168201915b505050505081526020016006820160009054906101000a900460ff161515151581526020016006820160019054906101000a900460ff16151515158152505090508673ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff160361299e57806060015184848151811061298457612983613858565b5b6020026020010181905250828061299a90613950565b9350505b5080806129aa90613950565b9150506125b3565b50819350505050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612a25826129dc565b810181811067ffffffffffffffff82111715612a4457612a436129ed565b5b80604052505050565b6000612a576129be565b9050612a638282612a1c565b919050565b600067ffffffffffffffff821115612a8357612a826129ed565b5b612a8c826129dc565b9050602081019050919050565b82818337600083830152505050565b6000612abb612ab684612a68565b612a4d565b905082815260208101848484011115612ad757612ad66129d7565b5b612ae2848285612a99565b509392505050565b600082601f830112612aff57612afe6129d2565b5b8135612b0f848260208601612aa8565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612b4382612b18565b9050919050565b612b5381612b38565b8114612b5e57600080fd5b50565b600081359050612b7081612b4a565b92915050565b60008060008060808587031215612b9057612b8f6129c8565b5b600085013567ffffffffffffffff811115612bae57612bad6129cd565b5b612bba87828801612aea565b9450506020612bcb87828801612b61565b9350506040612bdc87828801612b61565b925050606085013567ffffffffffffffff811115612bfd57612bfc6129cd565b5b612c0987828801612aea565b91505092959194509250565b60008115159050919050565b612c2a81612c15565b82525050565b6000602082019050612c456000830184612c21565b92915050565b6000819050919050565b612c5e81612c4b565b82525050565b6000602082019050612c796000830184612c55565b92915050565b600060208284031215612c9557612c946129c8565b5b600082013567ffffffffffffffff811115612cb357612cb26129cd565b5b612cbf84828501612aea565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612d2e578082015181840152602081019050612d13565b60008484015250505050565b6000612d4582612cf4565b612d4f8185612cff565b9350612d5f818560208601612d10565b612d68816129dc565b840191505092915050565b6000612d7f8383612d3a565b905092915050565b6000602082019050919050565b6000612d9f82612cc8565b612da98185612cd3565b935083602082028501612dbb85612ce4565b8060005b85811015612df75784840389528151612dd88582612d73565b9450612de383612d87565b925060208a01995050600181019050612dbf565b50829750879550505050505092915050565b60006020820190508181036000830152612e238184612d94565b905092915050565b600060208284031215612e4157612e406129c8565b5b6000612e4f84828501612b61565b91505092915050565b612e6181612b38565b82525050565b600082825260208201905092915050565b6000612e8382612cf4565b612e8d8185612e67565b9350612e9d818560208601612d10565b612ea6816129dc565b840191505092915050565b6000606082019050612ec66000830186612e58565b8181036020830152612ed88185612e78565b90508181036040830152612eec8184612e78565b9050949350505050565b600080600080600060a08688031215612f1257612f116129c8565b5b600086013567ffffffffffffffff811115612f3057612f2f6129cd565b5b612f3c88828901612aea565b9550506020612f4d88828901612b61565b945050604086013567ffffffffffffffff811115612f6e57612f6d6129cd565b5b612f7a88828901612aea565b935050606086013567ffffffffffffffff811115612f9b57612f9a6129cd565b5b612fa788828901612aea565b925050608086013567ffffffffffffffff811115612fc857612fc76129cd565b5b612fd488828901612aea565b9150509295509295909350565b600060c0820190508181036000830152612ffb8189612e78565b905061300a6020830188612e58565b6130176040830187612e58565b81810360608301526130298186612e78565b9050818103608083015261303d8185612e78565b905061304c60a0830184612c21565b979650505050505050565b600081905092915050565b600061306d82612cf4565b6130778185613057565b9350613087818560208601612d10565b80840191505092915050565b600061309f8284613062565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806130f157607f821691505b602082108103613104576131036130aa565b5b50919050565b7f696e76616c696465206365727469666963617465207575696400000000000000600082015250565b6000613140601983612e67565b915061314b8261310a565b602082019050919050565b6000602082019050818103600083015261316f81613133565b9050919050565b7f6f6e6c79206973737565722063616e20696e76616c696461746520636572746960008201527f6669636174650000000000000000000000000000000000000000000000000000602082015250565b60006131d2602683612e67565b91506131dd82613176565b604082019050919050565b60006020820190508181036000830152613201816131c5565b9050919050565b7f696e76616c696420726f6c650000000000000000000000000000000000000000600082015250565b600061323e600c83612e67565b915061324982613208565b602082019050919050565b6000602082019050818103600083015261326d81613231565b9050919050565b7f6f6e6c79206973737565722063616e206973737565206365727469666963617460008201527f6573000000000000000000000000000000000000000000000000000000000000602082015250565b60006132d0602283612e67565b91506132db82613274565b604082019050919050565b600060208201905081810360008301526132ff816132c3565b9050919050565b7f63657274696669636174652063616e2062652069737375656420746f2075736560008201527f7273206f6e6c7900000000000000000000000000000000000000000000000000602082015250565b6000613362602783612e67565b915061336d82613306565b604082019050919050565b6000602082019050818103600083015261339181613355565b9050919050565b7f636572746966696361746520776974682073616d65207575696420616c72656160008201527f6479207265676973746572656400000000000000000000000000000000000000602082015250565b60006133f4602d83612e67565b91506133ff82613398565b604082019050919050565b60006020820190508181036000830152613423816133e7565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261348c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261344f565b613496868361344f565b95508019841693508086168417925050509392505050565b6000819050919050565b60006134d36134ce6134c984612c4b565b6134ae565b612c4b565b9050919050565b6000819050919050565b6134ed836134b8565b6135016134f9826134da565b84845461345c565b825550505050565b600090565b613516613509565b6135218184846134e4565b505050565b5b818110156135455761353a60008261350e565b600181019050613527565b5050565b601f82111561358a5761355b8161342a565b6135648461343f565b81016020851015613573578190505b61358761357f8561343f565b830182613526565b50505b505050565b600082821c905092915050565b60006135ad6000198460080261358f565b1980831691505092915050565b60006135c6838361359c565b9150826002028217905092915050565b6135df82612cf4565b67ffffffffffffffff8111156135f8576135f76129ed565b5b61360282546130d9565b61360d828285613549565b600060209050601f831160018114613640576000841561362e578287015190505b61363885826135ba565b8655506136a0565b601f19841661364e8661342a565b60005b8281101561367657848901518255600182019150602085019450602081019050613651565b86831015613693578489015161368f601f89168261359c565b8355505b6001600288020188555050505b505050505050565b7f69737375657220616c7265616479207265676973746572656400000000000000600082015250565b60006136de601983612e67565b91506136e9826136a8565b602082019050919050565b6000602082019050818103600083015261370d816136d1565b9050919050565b7f616c726561647920726567697374657265642061732075736572000000000000600082015250565b600061374a601a83612e67565b915061375582613714565b602082019050919050565b600060208201905081810360008301526137798161373d565b9050919050565b7f7573657220616c72656164792072656769737465726564000000000000000000600082015250565b60006137b6601783612e67565b91506137c182613780565b602082019050919050565b600060208201905081810360008301526137e5816137a9565b9050919050565b7f616c726561647920726567697374657265642061732069737375657200000000600082015250565b6000613822601c83612e67565b915061382d826137ec565b602082019050919050565b6000602082019050818103600083015261385181613815565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008154613894816130d9565b61389e8186613057565b945060018216600081146138b957600181146138ce57613901565b60ff1983168652811515820286019350613901565b6138d78561342a565b60005b838110156138f9578154818901526001820191506020810190506138da565b838801955050505b50505092915050565b60006139168284613887565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061395b82612c4b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361398d5761398c613921565b5b60018201905091905056fea26469706673582212208e81303d448ac70d3191c98c5f3b6575c8b516b6a015d068852c540cede8ec5664736f6c63430008110033", 307 | "linkReferences": {}, 308 | "deployedLinkReferences": {} 309 | } 310 | -------------------------------------------------------------------------------- /client/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client/src/pages/CertificatePage.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useState, useEffect } from "react"; 3 | import { 4 | Heading, 5 | Container, 6 | Box, 7 | Table, 8 | Thead, 9 | Tbody, 10 | Tr, 11 | Th, 12 | Td, 13 | HStack, 14 | SkeletonCircle, 15 | Divider, 16 | useColorModeValue, 17 | Button, 18 | Text, 19 | } from "@chakra-ui/react"; 20 | import styles from "../styles/Home.module.css"; 21 | import { useClient } from "../hooks/useClient"; 22 | import { useParams } from 'react-router-dom'; 23 | import { useProfile } from "../hooks/useProfile"; 24 | const CertificatePage = () => { 25 | const params = useParams(); 26 | const [isLoading, setIsLoading] = useState(true); 27 | const { client } = useClient(); 28 | const [certificate, setCertificate] = useState([]); 29 | const { profile } = useProfile(); 30 | const teal200700 = useColorModeValue("teal.200", "teal.700"); 31 | const teal100700 = useColorModeValue("teal.100", "teal.700"); 32 | const [userProfile, setUserProfile] = useState([]); 33 | const [issuerProfile, setIssuerProfile] = useState([]); 34 | 35 | const invalidateCertificateAction = async (uuidOfCertificate) => { 36 | let res = await client.invalidateCertificate(uuidOfCertificate); 37 | res = await client.getCertificate(uuidOfCertificate); 38 | setCertificate(res); 39 | } 40 | 41 | // const getProfile = async(addressOfProfile) => { 42 | // return { 43 | // address: "aa", 44 | // name: "Chirag", 45 | // role: "User" 46 | // }; 47 | // } 48 | 49 | useEffect(() => { 50 | if (client && params.uuid) { 51 | async function fn() { 52 | setIsLoading(true); 53 | let res = await client.getCertificate(params.uuid); 54 | let userProfileRes = await client.getProfileByAddress(res.userAddr); 55 | let issuerProfileRes = await client.getProfileByAddress(res.issuerAddr); 56 | setUserProfile(userProfileRes); 57 | setIssuerProfile(issuerProfileRes); 58 | setCertificate(res); 59 | setIsLoading(false); 60 | } 61 | fn(); 62 | } 63 | }, [client, params, params.uuid]); 64 | console.log(profile); 65 | return ( 66 |
67 | 68 | 69 | 70 | {!isLoading ? 71 | 72 | Certificate {certificate.name} for {userProfile.name} By {issuerProfile.name} 73 | 74 | : 75 | Certificate Page 76 | } 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 98 | 99 | 100 | 101 | 113 | 114 | 115 | 116 | 128 | 129 | 130 | 131 | 143 | 144 | 145 | 146 | 158 | 159 | 160 | 161 | 173 | 174 | {(profile && profile.address == certificate.issuerAddr) && (certificate.isValid) ? 175 | 176 | 177 | 191 | 192 | : 193 | null 194 | } 195 | 196 |
Name Of Issuer 90 | {!isLoading ? 91 | 92 | {issuerProfile.name} 93 | 94 | : 95 | Loading... 96 | } 97 |
Name Of Student 105 | {!isLoading ? 106 | 107 | {userProfile.name} 108 | 109 | : 110 | Loading... 111 | } 112 |
Issued By (ADDRESS) 120 | {!isLoading ? 121 | 122 | {certificate.issuerAddr} 123 | 124 | : 125 | Loading... 126 | } 127 |
Issued For (ADDRESS) 135 | {!isLoading ? 136 | 137 | {certificate.userAddr} 138 | 139 | : 140 | Loading... 141 | } 142 |
IPFS Link 150 | {!isLoading ? 151 | 152 | Access IPFS Link ({certificate.ipfsUrl}) 153 | 154 | : 155 | Loading... 156 | } 157 |
Certificate Status 165 | {!isLoading ? (certificate.isValid ? 166 | Valid Certificate 167 | : 168 | In-Valid Certificate) 169 | : 170 | Loading... 171 | } 172 |
Action 181 | {!isLoading ? (certificate.isValid ? 182 | 185 | : 186 | In-Valid Certificate) 187 | : 188 | Loading... 189 | } 190 |
197 |
198 |
199 |
200 | ); 201 | } 202 | 203 | export default CertificatePage; 204 | -------------------------------------------------------------------------------- /client/src/pages/ConnectWalletPage.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | import { 3 | Heading, 4 | useBreakpointValue, 5 | useColorModeValue, 6 | Container, 7 | SimpleGrid, 8 | Divider, 9 | Icon, 10 | SkeletonCircle, 11 | HStack, 12 | Button, 13 | } from "@chakra-ui/react"; 14 | import { FcApproval, FcManager, FcBusinessman } from "react-icons/fc"; 15 | import FeatureBox from "../components/FeatureBox"; 16 | import styles from "../styles/Home.module.css"; 17 | import { useNavigate } from "react-router-dom"; 18 | import { useMetamask } from "../hooks/useMetamask"; 19 | 20 | const ConnectWalletPage = () => { 21 | const navigate = useNavigate(); 22 | const { connect, isConnected } = useMetamask(); 23 | 24 | useEffect(() => { 25 | if (isConnected) { 26 | navigate("/"); 27 | } 28 | }, [isConnected, navigate]); 29 | 30 | return ( 31 |
32 | 33 | {" "} 34 | 41 | A modern & secure way of managing student documents using
{" "} 42 | Ethereum Blockchain ✨ 43 |
44 | 59 | {/* */} 60 |
61 | 66 | 67 | 68 | 69 | Type of users 70 | 71 | 72 | 73 | 74 | } 76 | title={"Verifier"} 77 | text={ 78 | "Verifier is an external authority eg: an employer who is trying to verify the authenticity of certificate" 79 | } 80 | /> 81 | } 83 | title={"Issuer"} 84 | text={ 85 | "Issuer is an entity that issues the certificate in student's name, eg: University" 86 | } 87 | /> 88 | } 90 | title={"Student"} 91 | text={ 92 | "The person who is enrolled in a university and has a certificate issued by university" 93 | } 94 | /> 95 | 96 | 97 |
98 | ); 99 | }; 100 | 101 | export default ConnectWalletPage; 102 | -------------------------------------------------------------------------------- /client/src/pages/Index.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import { useNavigate } from "react-router-dom"; 3 | import { useMetamask } from "../hooks/useMetamask"; 4 | import EtherDocsClient from "../lib/EtherDocsClient"; 5 | import Etherdocs from "../lib/Etherdocs.json"; 6 | import config from "../config"; 7 | import { useProfile } from "../hooks/useProfile"; 8 | import { useClient } from "../hooks/useClient"; 9 | 10 | const Index = () => { 11 | const [isMetamaskInstalled] = useState( 12 | window.ethereum === undefined ? false : true 13 | ); 14 | const { setProfile } = useProfile(); 15 | const { isConnected } = useMetamask(); 16 | const { client, setClient } = useClient(); 17 | console.log("client state"); 18 | console.log(client, setClient); 19 | 20 | const navigate = useNavigate(); 21 | 22 | useEffect(() => { 23 | (async () => { 24 | if (!isMetamaskInstalled) { 25 | navigate("/install-metamask"); 26 | } else if (isConnected) { 27 | const client = new EtherDocsClient(); 28 | await client.setup( 29 | Etherdocs.abi, 30 | config.contractAddress 31 | ) 32 | setClient(client); 33 | const profile = await client.getProfile(); 34 | setProfile(profile); 35 | console.log("profile"); 36 | console.log(profile); 37 | const isRegistered = await client.isRegistered(); 38 | if (isRegistered) { 39 | navigate("/is-registered"); 40 | } else { 41 | navigate("/is-not-registered"); 42 | } 43 | } else { 44 | navigate("/connect-wallet"); 45 | } 46 | })(); 47 | }, [isConnected, navigate, isMetamaskInstalled]); 48 | 49 | return
Index page
; 50 | }; 51 | 52 | export default Index; 53 | -------------------------------------------------------------------------------- /client/src/pages/IssueNewCertiForm.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useRef } from "react"; 2 | import { 3 | Flex, 4 | Box, 5 | FormControl, 6 | FormLabel, 7 | Input, 8 | Stack, 9 | Button, 10 | Heading, 11 | Text, 12 | useColorModeValue, 13 | InputRightAddon, 14 | InputGroup, 15 | Alert, 16 | AlertIcon, 17 | AlertDescription, 18 | FormHelperText, 19 | Textarea, 20 | } from "@chakra-ui/react"; 21 | import { ArrowBackIcon } from "@chakra-ui/icons"; 22 | import { Link, useNavigate } from "react-router-dom"; 23 | import { useForm } from "react-hook-form"; 24 | import FileUpload from "../components/FileUpload"; 25 | import { useMetamask } from "../hooks/useMetamask"; 26 | import axios from "axios"; 27 | import { useClient } from "../hooks/useClient"; 28 | const IssuerForm = () => { 29 | const { 30 | handleSubmit, 31 | register, 32 | control, 33 | formState: { isSubmitting, errors }, 34 | } = useForm({ 35 | mode: "onChange", 36 | }); 37 | const inputRef = useRef(); 38 | const [file, setFile] = useState(null); 39 | const [error, setError] = useState(""); 40 | const { isConnected } = useMetamask(); 41 | const navigate = useNavigate(); 42 | const { client } = useClient(); 43 | async function onSubmit(data) { 44 | // console.log(inputRef.current.files[0]); 45 | const formData = new FormData(); 46 | 47 | formData.append("certificate", inputRef.current.files[0]); 48 | 49 | const response = await axios.post("http://localhost:5000/issue", formData, { 50 | headers: { 51 | "Content-Type": "multipart/form-data", 52 | }, 53 | }); 54 | console.log(response.data); 55 | client 56 | .issueCertificate( 57 | data.certificate_name, 58 | data.new_address, 59 | response.data.uuid, 60 | response.data.hash, 61 | response.data.ifpsLink 62 | ) 63 | .then(() => { 64 | navigate("/is-registered/issuer"); 65 | }) 66 | .catch((err) => console.log(err)); 67 | } 68 | 69 | return ( 70 | <> 71 |
72 | 73 | 74 | 75 | Go Back 76 | 77 | 78 | 79 | Issue a new certificate 80 | 81 | 82 | 88 |
89 | 90 | 91 | Certificate Name 92 | 96 | 97 | 98 | Student Name 99 | 103 | 104 | 105 | Address 106 | 110 | 111 | 112 | 113 | File Upload 114 | 122 | Only PDF format is acceptable 123 | 124 | 125 | 126 | {error ? ( 127 | 128 | 129 | {error} 130 | 131 | ) : null} 132 | 133 | {errors.issuer_name || errors.new_address || errors.doc ? ( 134 | 135 | 136 | 137 | {" "} 138 | All Fields are Required 139 | 140 | 141 | ) : null} 142 | 143 | 144 | {/* conditional rendering if wallet is connected will come here */} 145 | 146 | {isConnected ? ( 147 | 157 | ) : ( 158 | 159 | 160 | 161 | Please Connect Your Wallet First to Register 162 | 163 | 164 | )} 165 | 166 | 167 | 168 |
169 |
170 |
171 |
172 | 173 | ); 174 | }; 175 | 176 | export default IssuerForm; 177 | -------------------------------------------------------------------------------- /client/src/pages/IssuerForm.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { 3 | Flex, 4 | Box, 5 | FormControl, 6 | FormLabel, 7 | Input, 8 | Stack, 9 | Button, 10 | Heading, 11 | Text, 12 | useColorModeValue, 13 | InputRightAddon, 14 | InputGroup, 15 | Alert, 16 | AlertIcon, 17 | AlertDescription, 18 | FormHelperText, 19 | Textarea, 20 | } from "@chakra-ui/react"; 21 | import { ArrowBackIcon } from "@chakra-ui/icons"; 22 | import { Link, useNavigate } from "react-router-dom"; 23 | import { useForm } from "react-hook-form"; 24 | import FileUpload from "../components/FileUpload"; 25 | import { useMetamask } from "../hooks/useMetamask"; 26 | import { useClient } from "../hooks/useClient"; 27 | const IssuerForm = () => { 28 | const { client } = useClient(); 29 | const { 30 | handleSubmit, 31 | register, 32 | formState: { isSubmitting, errors }, 33 | } = useForm({ 34 | mode: "onChange", 35 | }); 36 | const [error, setError] = useState(""); 37 | const { isConnected } = useMetamask(); 38 | const navigate = useNavigate(); 39 | 40 | async function onSubmit(data) { 41 | client.registerIssuer(data.issuer_name).then(() => navigate("/")); 42 | // console.log( 43 | // data 44 | // ); 45 | } 46 | 47 | return ( 48 | <> 49 |
50 | 51 | 52 | 53 | Back to Home 54 | 55 | 56 | 57 | Register as a issuer 🏫 58 | 59 | 60 | 66 |
67 | 68 | 69 | Name 70 | 74 | 75 | 76 | {error ? ( 77 | 78 | 79 | {error} 80 | 81 | ) : null} 82 | 83 | {errors.issuer_name ? ( 84 | 85 | 86 | 87 | {" "} 88 | All Fields are Required 89 | 90 | 91 | ) : null} 92 | 93 | 94 | {/* conditional rendering if wallet is connected will come here */} 95 | {isConnected ? ( 96 | 97 | 107 | 108 | ) : ( 109 | 110 | 111 | 112 | Please Connect Your Wallet First to Register 113 | 114 | 115 | )} 116 | 117 | 118 |
119 |
120 |
121 |
122 | 123 | ); 124 | }; 125 | 126 | export default IssuerForm; 127 | -------------------------------------------------------------------------------- /client/src/pages/IssuerIsRegistered.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { useEffect } from "react"; 3 | import { 4 | Heading, 5 | useBreakpointValue, 6 | useColorModeValue, 7 | Text, 8 | Button, 9 | Flex, 10 | Container, 11 | Box, 12 | Spacer, 13 | Table, 14 | Thead, 15 | Tbody, 16 | Tooltip, 17 | Tr, 18 | Th, 19 | Td, 20 | TableCaption, 21 | Skeleton, 22 | Alert, 23 | AlertIcon, 24 | AlertDescription, 25 | HStack, 26 | Stack, 27 | SkeletonCircle, 28 | Divider, 29 | } from "@chakra-ui/react"; 30 | import { Link, useNavigate } from "react-router-dom"; 31 | import styles from "../styles/Home.module.css"; 32 | import { useClient } from "../hooks/useClient"; 33 | 34 | const IssuerIsRegistered = () => { 35 | const { client } = useClient(); 36 | const [certiCount, setCertiCount] = useState(0); 37 | const [certificates, setCertificates] = useState([]); 38 | const navigate = useNavigate(); 39 | 40 | useEffect(() => { 41 | async function fn() { 42 | if (client) { 43 | let res = await client.getCertificatesIssuedBy(); 44 | console.log(res); 45 | setCertificates(res); 46 | setCertiCount(res.length); 47 | } 48 | } 49 | fn(); 50 | }, [client]); 51 | 52 | return ( 53 |
54 | 55 | 56 | 57 | 66 | You have Issued {certiCount} Certificates 67 | 68 | 69 | 70 | 71 | 72 | 86 | 87 | 88 | {" "} 89 | {/* */} 90 | 91 | 92 | 93 | 94 | 95 | 96 | {/* */} 97 | 98 | {/* */} 101 | 102 | 103 | 104 | 108 | {certificates.map((cert) => { 109 | return ( 110 | 111 | 112 | 113 | {/* */} 114 | 115 | 118 | 119 | ); 120 | })} 121 | 122 |
NameUUIDName Issued To 99 | Wallet Address 100 | Link to certificate
{cert.name}{cert.uuid}Sem-6 Marksheet{cert.userAddr} 116 | 117 |
123 |
124 |
125 |
126 | ); 127 | }; 128 | 129 | export default IssuerIsRegistered; 130 | -------------------------------------------------------------------------------- /client/src/pages/LandingPage.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | import FeatureBox from "../components/FeatureBox"; 3 | import { 4 | Heading, 5 | useBreakpointValue, 6 | useColorModeValue, 7 | Container, 8 | SimpleGrid, 9 | Divider, 10 | Icon, 11 | SkeletonCircle, 12 | HStack, 13 | } from "@chakra-ui/react"; 14 | import Footer from "../components/Footer"; 15 | import { FcApproval, FcManager, FcBusinessman } from "react-icons/fc"; 16 | import styles from "../styles/Home.module.css"; 17 | 18 | const LandingPage = () => { 19 | const col1 = useColorModeValue("gray.800", "white"); 20 | const alignText = useBreakpointValue({ base: "left" }); 21 | 22 | return ( 23 |
24 | { 25 | <> 26 |
27 | 28 | {" "} 29 | 36 | A modern & secure way of managing student documents using
{" "} 37 | Ethereum Blockchain ✨{" "} 38 |
39 | {/* Navlink will come here */} 40 | {/* 41 | 53 | */} 54 |
55 | 56 | 61 | 62 | 63 | 64 | Type of users 65 | 66 | 67 | 68 | 69 | } 71 | title={"Verifier"} 72 | text={ 73 | "Verifier is an external authority eg: an employer who is trying to verify the authenticity of certificate" 74 | } 75 | /> 76 | } 78 | title={"Issuer"} 79 | text={ 80 | "Issuer is an entity that issues the certificate in student's name, eg: University" 81 | } 82 | /> 83 | } 85 | title={"Student"} 86 | text={ 87 | "The person who is enrolled in a university and has a certificate issued by university" 88 | } 89 | /> 90 | 91 | 92 |
93 |
94 | 95 | } 96 |
97 | ); 98 | }; 99 | 100 | export default LandingPage; 101 | -------------------------------------------------------------------------------- /client/src/pages/NotRegisteredUserPage.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import FeatureBox from '../components/FeatureBox'; 3 | import { 4 | Heading, 5 | useBreakpointValue, 6 | useColorModeValue, 7 | Button, 8 | Container, 9 | SimpleGrid, 10 | Divider, 11 | Icon, 12 | SkeletonCircle, 13 | HStack, 14 | Text 15 | } from "@chakra-ui/react"; 16 | import { FcDonate, FcManager, FcFlashOn } from "react-icons/fc"; 17 | import { Link } from 'react-router-dom'; 18 | import Card from '../components/Card'; 19 | import styles from '../styles/Home.module.css' 20 | import data from '../UnRegisteredData'; 21 | 22 | const NotRegisteredUserPage = () => { 23 | 24 | return
25 |
26 | 27 | 28 | 29 | 30 | Register as 31 | 32 | 33 | 34 | 35 | 36 | 37 | {data.map((fund) => { 38 | return ( 39 |
40 | 48 |
49 | ); 50 | })} 51 | 52 |
53 |
54 | 55 |
56 |
; 57 | }; 58 | 59 | export default NotRegisteredUserPage; 60 | -------------------------------------------------------------------------------- /client/src/pages/RegisteredUserPage.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useEffect } from 'react'; 3 | import FeatureBox from '../components/FeatureBox'; 4 | import { 5 | Heading, 6 | useBreakpointValue, 7 | useColorModeValue, 8 | Button, 9 | Container, 10 | SimpleGrid, 11 | Divider, 12 | Icon, 13 | SkeletonCircle, 14 | HStack, 15 | Text 16 | } from "@chakra-ui/react"; 17 | import { FcDonate, FcManager, FcFlashOn } from "react-icons/fc"; 18 | import { Link } from 'react-router-dom'; 19 | import Card from '../components/Card'; 20 | import styles from '../styles/Home.module.css' 21 | import data from '../RegisteredData'; 22 | import { useNavigate } from 'react-router-dom'; 23 | import {useProfile} from '../hooks/useProfile'; 24 | 25 | const RegisteredUserPage = () => { 26 | 27 | const {profile} = useProfile(); 28 | const navigate = useNavigate(); 29 | 30 | useEffect(()=>{ 31 | if(profile.role == "User"){ 32 | navigate("/is-registered/student") 33 | }else{ 34 | navigate("/is-registered/issuer") 35 | } 36 | },[]) 37 | 38 | return
39 |
40 | 41 | 42 | 43 | 44 | Welcome back! 45 | 46 | 47 | 48 | 49 | 50 | 51 | {data.map((fund) => { 52 | return ( 53 |
54 | 62 |
63 | ); 64 | })} 65 | 66 |
67 |
68 | 69 |
70 |
; 71 | }; 72 | 73 | export default RegisteredUserPage; 74 | -------------------------------------------------------------------------------- /client/src/pages/StudentForm.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react' 2 | import { 3 | Flex, 4 | Box, 5 | FormControl, 6 | FormLabel, 7 | Input, 8 | Stack, 9 | Button, 10 | Heading, 11 | Text, 12 | useColorModeValue, 13 | InputRightAddon, 14 | InputGroup, 15 | Alert, 16 | AlertIcon, 17 | AlertDescription, 18 | FormHelperText, 19 | Textarea, 20 | } from "@chakra-ui/react"; 21 | import { ArrowBackIcon } from "@chakra-ui/icons"; 22 | import { Link, useNavigate } from 'react-router-dom'; 23 | import { useForm } from "react-hook-form"; 24 | import FileUpload from '../components/FileUpload'; 25 | import { useMetamask } from '../hooks/useMetamask'; 26 | import { useClient } from '../hooks/useClient'; 27 | // import { useNavigate } from 'react-router-dom'; 28 | const StudentForm = () => { 29 | const {client} = useClient() 30 | const { handleSubmit, register, formState: { isSubmitting, errors } } = useForm({ 31 | mode: "onChange" 32 | }) 33 | const [error, setError] = useState(""); 34 | const { isConnected } = useMetamask(); 35 | const navigate = useNavigate(); 36 | 37 | async function onSubmit(data) { 38 | console.log(data); 39 | client.registerUser(data.student_name).then(()=>navigate('/')); 40 | // console.log(); 41 | 42 | } 43 | 44 | return ( 45 | <> 46 |
47 | 48 | 49 | 50 | Back to Home 51 | 52 | 53 | 54 | Register as a Student 👨‍🎓👩‍🎓 55 | 56 | 57 | 63 |
64 | 65 | 66 | 67 | 68 | Name 69 | 73 | 74 | 75 | 76 | {error ? ( 77 | 78 | 79 | {error} 80 | 81 | ) : null} 82 | 83 | {errors.student_name ? ( 84 | 85 | 86 | 87 | {" "} 88 | All Fields are Required 89 | 90 | 91 | ) : null} 92 | 93 | 94 | 95 | {/* conditional rendering if wallet is connected will come here */} 96 | {isConnected ? 97 | 98 | ( 99 | 109 | 110 | ) :( 111 | 112 | 113 | Please Connect Your Wallet First to Register 114 | 115 | ) 116 | } 117 | 118 | 119 |
120 |
121 |
122 |
123 | 124 | ) 125 | } 126 | 127 | export default StudentForm -------------------------------------------------------------------------------- /client/src/pages/StudentIsRegistered.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useState, useEffect } from "react"; 3 | import { 4 | Heading, 5 | Container, 6 | Box, 7 | Table, 8 | Thead, 9 | Tbody, 10 | Tr, 11 | Th, 12 | Td, 13 | HStack, 14 | SkeletonCircle, 15 | Divider, 16 | useColorModeValue, 17 | Button, 18 | } from "@chakra-ui/react"; 19 | import { Link, Navigate, useNavigate } from "react-router-dom"; 20 | import styles from "../styles/Home.module.css"; 21 | import { useClient } from "../hooks/useClient"; 22 | 23 | const StudentIsRegistered = () => { 24 | const { client } = useClient(); 25 | const [certiCount, setCertiCount] = useState(3); 26 | const [certificates, setCertificates] = useState([]); 27 | const [viewCertificateUrl, setViewCertificateUrl] = useState([]); 28 | const navigate = useNavigate(); 29 | 30 | useEffect(() => { 31 | async function fn() { 32 | if (client) { 33 | let res = await client.getCertificatesIssuedFor(); 34 | console.log(res); 35 | setCertificates(res); 36 | setCertiCount(res.length); 37 | } 38 | } 39 | fn(); 40 | }, [client]); 41 | 42 | return ( 43 |
44 | 45 | 46 | 47 | 48 | Found {certiCount} Certificates 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {/* */} 61 | 62 | {/* */} 65 | 66 | 67 | 68 | 72 | {certificates.map((cert) => { 73 | console.log(cert); 74 | return ( 75 | 76 | 77 | 78 | {/* */} 79 | 80 | 83 | 84 | ); 85 | })} 86 | 87 | {/* 88 | 89 | 90 | 91 | 92 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 104 | */} 105 | 106 |
NameUUIDName Issued By 63 | Wallet Address 64 | Link to certificate
{cert.name}{cert.uuid}Sem-6 Marksheet{cert.issuerAddr} 81 | 82 |
2HSC MarksheetSVP College of Science and Commerce0xffeyyeyeyeye 93 | https:// 94 |
3SSC MarksheetShantinagar HighSchool0xffeyyeyeyeye 102 | https:// 103 |
107 |
108 |
109 |
110 | ); 111 | }; 112 | 113 | export default StudentIsRegistered; 114 | -------------------------------------------------------------------------------- /client/src/pages/VerifyForm.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useRef } from "react"; 2 | import { 3 | Flex, 4 | Box, 5 | FormControl, 6 | FormLabel, 7 | Input, 8 | Stack, 9 | Button, 10 | Heading, 11 | Text, 12 | useColorModeValue, 13 | InputRightAddon, 14 | InputGroup, 15 | Alert, 16 | AlertIcon, 17 | AlertDescription, 18 | FormHelperText, 19 | Textarea, 20 | Toast, 21 | useToast, 22 | } from "@chakra-ui/react"; 23 | import { ArrowBackIcon } from "@chakra-ui/icons"; 24 | import { Link } from "react-router-dom"; 25 | import { useForm } from "react-hook-form"; 26 | import FileUpload from "../components/FileUpload"; 27 | import axios from "axios"; 28 | import { useMetamask } from "../hooks/useMetamask"; 29 | import { useClient } from "../hooks/useClient"; 30 | 31 | const VerifyForm = () => { 32 | const { client } = useClient(); 33 | const [error, setError] = useState(""); 34 | const { 35 | handleSubmit, 36 | register, 37 | control, 38 | formState: { isSubmitting, errors }, 39 | } = useForm({ 40 | mode: "onChange", 41 | }); 42 | const { isConnected } = useMetamask(); 43 | const inputRef = useRef(); 44 | const toast = useToast(); 45 | async function onSubmit(data) { 46 | const formData = new FormData(); 47 | 48 | formData.append("certificate", inputRef.current.files[0]); 49 | 50 | const response = await axios.post( 51 | "http://localhost:5000/calculatehash", 52 | formData, 53 | { 54 | headers: { 55 | "Content-Type": "multipart/form-data", 56 | }, 57 | } 58 | ); 59 | // console.log(response.data); 60 | console.log("data", data); 61 | client 62 | .verifyCertificate( 63 | data.UUID, 64 | data.Issued_by, 65 | data.Issued_to, 66 | response.data.hash 67 | ) 68 | .then((res) => { 69 | console.log(res); 70 | if (res) { 71 | toast({ 72 | title: "Document Is Authentic", 73 | variant: "left-accent", 74 | position: "bottom-right", 75 | duration: 10000, 76 | status: "success", 77 | isClosable: true, 78 | }); 79 | } else { 80 | toast({ 81 | title: "Document Is Not Authentic", 82 | variant: "left-accent", 83 | position: "bottom-right", 84 | duration: 10000, 85 | status: "error", 86 | isClosable: true, 87 | }); 88 | } 89 | }) 90 | .catch((err) => console.log(err)); 91 | } 92 | 93 | return ( 94 | <> 95 |
96 | 97 | 98 | 99 | Back to Home 100 | 101 | 102 | 103 | Verify a document 📃 104 | 105 | 106 | 112 |
113 | 114 | 115 | Issuer Wallet Address 116 | 120 | 121 | 122 | 123 | Student's Wallet Address 124 | 128 | 129 | 130 | 131 | UUID 132 | 136 | 137 | 138 | 139 | File Upload 140 | 148 | Only PDF format is acceptable 149 | 150 | 151 | 152 | {error ? ( 153 | 154 | 155 | {error} 156 | 157 | ) : null} 158 | 159 | {errors.minimumContribution || 160 | errors.name || 161 | errors.description || 162 | errors.UUID || 163 | errors.target ? ( 164 | 165 | 166 | 167 | {" "} 168 | All Fields are Required 169 | 170 | 171 | ) : null} 172 | 173 | 174 | {/* conditional rendering if wallet is connected will come here */} 175 | 176 | {isConnected ? ( 177 | 187 | ) : ( 188 | 189 | 190 | 191 | Please Connect Your Wallet to Register 192 | 193 | 194 | )} 195 | 196 | 197 | 198 |
199 |
200 |
201 |
202 | 203 | ); 204 | }; 205 | 206 | export default VerifyForm; 207 | -------------------------------------------------------------------------------- /client/src/pages/WarningInstallMetaMask.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | import { 3 | Heading, 4 | useBreakpointValue, 5 | useColorModeValue, 6 | Button, 7 | Container, 8 | SimpleGrid, 9 | Divider, 10 | Icon, 11 | SkeletonCircle, 12 | HStack, 13 | } from "@chakra-ui/react"; 14 | import styles from "../styles/Home.module.css"; 15 | const WarningInstallMetaMask = () => { 16 | return ( 17 |
18 | 19 | {" "} 20 | 27 | You need install MetaMask Wallet 28 | 29 | 30 |
31 | ); 32 | }; 33 | 34 | export default WarningInstallMetaMask; 35 | -------------------------------------------------------------------------------- /client/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /client/src/scripts/loadAbi.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -x 5 | 6 | cp ../../../smart_contracts/artifacts/contracts/Etherdocs.sol/Etherdocs.json ../lib -------------------------------------------------------------------------------- /client/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /client/src/styles/Home.module.css: -------------------------------------------------------------------------------- 1 | .container { 2 | min-height: 100vh; 3 | padding: 0 0.5rem; 4 | display: flex; 5 | flex-direction: column; 6 | justify-content: center; 7 | align-items: center; 8 | height: 100vh; 9 | } 10 | 11 | .main { 12 | padding: 5rem 0; 13 | flex: 1; 14 | display: flex; 15 | flex-direction: column; 16 | justify-content: center; 17 | align-items: center; 18 | } 19 | 20 | .footer { 21 | width: 100%; 22 | height: 100px; 23 | border-top: 1px solid #eaeaea; 24 | display: flex; 25 | justify-content: center; 26 | align-items: center; 27 | } 28 | 29 | .footer a { 30 | display: flex; 31 | justify-content: center; 32 | align-items: center; 33 | flex-grow: 1; 34 | } 35 | 36 | .title a { 37 | color: #0070f3; 38 | text-decoration: none; 39 | } 40 | 41 | .title a:hover, 42 | .title a:focus, 43 | .title a:active { 44 | text-decoration: underline; 45 | } 46 | 47 | .title { 48 | margin: 0; 49 | line-height: 1.15; 50 | font-size: 4rem; 51 | } 52 | 53 | .title, 54 | .description { 55 | text-align: center; 56 | } 57 | 58 | .description { 59 | line-height: 1.5; 60 | font-size: 1.5rem; 61 | } 62 | 63 | .code { 64 | background: #fafafa; 65 | border-radius: 5px; 66 | padding: 0.75rem; 67 | font-size: 1.1rem; 68 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, 69 | Bitstream Vera Sans Mono, Courier New, monospace; 70 | } 71 | 72 | .grid { 73 | display: flex; 74 | align-items: center; 75 | justify-content: center; 76 | flex-wrap: wrap; 77 | max-width: 800px; 78 | margin-top: 3rem; 79 | } 80 | 81 | .card { 82 | margin: 1rem; 83 | padding: 1.5rem; 84 | text-align: left; 85 | color: inherit; 86 | text-decoration: none; 87 | border: 1px solid #eaeaea; 88 | border-radius: 10px; 89 | transition: color 0.15s ease, border-color 0.15s ease; 90 | width: 45%; 91 | } 92 | 93 | .card:hover, 94 | .card:focus, 95 | .card:active { 96 | color: #0070f3; 97 | border-color: #0070f3; 98 | } 99 | 100 | .card h2 { 101 | margin: 0 0 1rem 0; 102 | font-size: 1.5rem; 103 | } 104 | 105 | .card p { 106 | margin: 0; 107 | font-size: 1.25rem; 108 | line-height: 1.5; 109 | } 110 | 111 | .logo { 112 | height: 1em; 113 | margin-left: 0.5rem; 114 | } 115 | 116 | @media (max-width: 600px) { 117 | .grid { 118 | width: 100%; 119 | flex-direction: column; 120 | } 121 | } -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | client: 5 | build: 6 | context: ./client 7 | ports: 8 | - "3000:3000" 9 | container_name: etherdocs-client 10 | 11 | server: 12 | build: 13 | context: ./server 14 | ports: 15 | - "5000:5000" 16 | container_name: etherdocs-server 17 | 18 | chain: 19 | build: 20 | context: ./smart_contracts 21 | ports: 22 | - "8545:8545" 23 | container_name: etherdocs-chain 24 | -------------------------------------------------------------------------------- /docker-setup.txt: -------------------------------------------------------------------------------- 1 | how to setup etherdocs 2 | 3 | requirements 4 | - metamask extension 5 | - ipfs companion extension 6 | - ipfs desktop 7 | - docker 8 | 9 | 10 | steps 11 | 12 | - cd into the client folder and execute the build.sh script with "bash build.sh" 13 | - start ipfs desktop application 14 | - add the local chain with rpc url http://127.0.0.1:8545/ and chainid 31337 to metamask and reset account data 15 | - run "docker-compose up" in the project root folder 16 | - get the logs of the etherdocs-chain container and use the private keys to add accounts to the metamask wallet 17 | - make sure to clear account data before every new session 18 | - visit http://localhost:3000/ -------------------------------------------------------------------------------- /server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | *.env 4 | *.rest 5 | *.http 6 | uploads 7 | appended -------------------------------------------------------------------------------- /server/.nvmrc: -------------------------------------------------------------------------------- 1 | v16.16.0 2 | -------------------------------------------------------------------------------- /server/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use the official Node.js image 2 | FROM node:16 3 | 4 | # Set the working directory 5 | WORKDIR /app 6 | 7 | # Copy the package.json and package-lock.json 8 | COPY package*.json ./ 9 | 10 | # Install dependencies 11 | RUN npm install 12 | 13 | # Copy the rest of the application code 14 | COPY . . 15 | 16 | # Expose the Hardhat network port 17 | EXPOSE 5000 18 | 19 | # Start the Hardhat node and deploy the contracts 20 | CMD ["node","index.js"] 21 | -------------------------------------------------------------------------------- /server/dummy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/server/dummy.pdf -------------------------------------------------------------------------------- /server/dummy2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopersLeague/EtherDocs/0c4581a0261761c0011171f413858028a53a186f/server/dummy2.pdf -------------------------------------------------------------------------------- /server/index.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | import cors from "cors"; 3 | // const express = require("express"); 4 | import express from "express"; 5 | import morgan from "morgan"; 6 | // const morgan = require("morgan"); 7 | // const multer = require("multer"); 8 | import multer from "multer"; 9 | // const uuid = require("uuid").v4; 10 | import { v4 as uuid } from "uuid"; 11 | // const path = require("path"); 12 | import path from "path"; 13 | // const crypto = require("crypto"); 14 | import crypto from "crypto"; 15 | // const fsp = require("fs/promises"); 16 | import fsp from "fs/promises"; 17 | // const createHttpError = require("http-errors"); 18 | import createHttpError from "http-errors"; 19 | // const ipfsClient = require("ipfs-http-client"); 20 | import { create } from "ipfs-http-client"; 21 | // const fs = require("fs"); 22 | import fs from "fs"; 23 | import { PDFDocument } from "pdf-lib"; 24 | 25 | //constants 26 | 27 | const PORT = process.env.PORT || 5000; 28 | const UPLOADS_DIR = path.join(process.cwd(), "uploads"); 29 | const NODE_ENV = process.env.NODE_ENV || "development"; 30 | const APPENDED_DIR = path.join(process.cwd(), "appended"); 31 | // const IPFS_NODE_HOST = "127.0.0.1"; 32 | const IPFS_NODE_HOST = "host.docker.internal" 33 | 34 | //utils 35 | 36 | /** 37 | * @param {string} filepath 38 | * @returns string 39 | */ 40 | async function sha256(filepath) { 41 | const contentbuff = await fsp.readFile(filepath); 42 | const hash = crypto.createHash("sha256").update(contentbuff).digest("hex"); 43 | return hash; 44 | } 45 | 46 | /** 47 | * 48 | * @param {(req: import('express').Request,res: import('express').Response,next: import("express").NextFunction)=>Promise} fn 49 | * @returns {import("express").RequestHandler} 50 | */ 51 | function catchAsync(fn) { 52 | return function (req, res, next) { 53 | fn(req, res, next).catch(next); 54 | }; 55 | } 56 | const ipfs = create({ 57 | host: IPFS_NODE_HOST, 58 | protocol: "http", 59 | port: 5001, 60 | }); 61 | 62 | /** 63 | * @param {string} filePath 64 | */ 65 | async function uploadFileToIPFS(filePath) { 66 | // Read the file from disk 67 | const file = fs.readFileSync(filePath); 68 | 69 | // Upload the file to IPFS 70 | const result = await ipfs.add(file, { 71 | pin: true, 72 | }); 73 | 74 | return result.cid.toString(); 75 | } 76 | 77 | /** 78 | * @param {string} uuidStr 79 | * @param {string} pdfInputPath 80 | * @param {string} pdfOutputPath 81 | */ 82 | async function appendUUIDtoPDF(uuidStr, pdfInputPath, pdfOutputPath) { 83 | // Load your existing PDF 84 | const pdfBytes = fs.readFileSync(pdfInputPath); 85 | 86 | // Load the PDFDocument 87 | const pdfDoc = await PDFDocument.load(pdfBytes); 88 | 89 | // Get the number of pages in the PDF 90 | const numPages = pdfDoc.getPageCount(); 91 | 92 | // Create a new UUID 93 | const uuid = uuidStr; 94 | 95 | // Add the UUID to each page 96 | for (let i = 0; i < numPages; i++) { 97 | const page = pdfDoc.getPage(i); 98 | const { width, height } = page.getSize(); 99 | const text = `UUID: ${uuid}`; 100 | const fontSize = 10; 101 | 102 | // Add the text to the top right corner of the page 103 | // const textWidth = page.getFont("Helvetica").widthOfText(text, fontSize); 104 | const x = width - 250; 105 | const y = height - 20; 106 | page.drawText(text, { x, y, size: fontSize }); 107 | } 108 | 109 | // Save the modified PDF 110 | const modifiedPdfBytes = await pdfDoc.save(); 111 | fs.writeFileSync(pdfOutputPath, modifiedPdfBytes); 112 | } 113 | 114 | //setup 115 | 116 | if (!fs.existsSync(UPLOADS_DIR)) { 117 | fs.mkdirSync(UPLOADS_DIR); 118 | } 119 | if (!fs.existsSync(APPENDED_DIR)) { 120 | fs.mkdirSync(APPENDED_DIR); 121 | } 122 | 123 | const upload = multer({ 124 | storage: multer.diskStorage({ 125 | destination: function (req, file, cb) { 126 | cb(null, UPLOADS_DIR); 127 | }, 128 | filename: function (req, file, cb) { 129 | const ext = path.extname(file.originalname); 130 | const id = uuid(); 131 | cb(null, id + ext); 132 | }, 133 | }), 134 | }); 135 | 136 | //middleware 137 | 138 | const app = express(); 139 | app.use(cors()); 140 | app.use(express.json()); 141 | app.use(express.urlencoded({ extended: false })); 142 | app.use(morgan("common")); 143 | 144 | app.get("/", (req, res) => { 145 | res.json({ 146 | status: "ok", 147 | }); 148 | }); 149 | 150 | app.get("/healthcheck", (req, res) => { 151 | res.json({ 152 | status: "ok", 153 | }); 154 | }); 155 | 156 | if (NODE_ENV == "development") { 157 | app.get("/calculatehash", (req, res) => { 158 | const template = ` 159 |
160 | 161 | 162 |
163 | `; 164 | res.send(template); 165 | }); 166 | } 167 | 168 | if (NODE_ENV == "development") { 169 | app.get("/issue", (req, res) => { 170 | const template = ` 171 |
172 | 173 | 174 |
175 | `; 176 | res.send(template); 177 | }); 178 | } 179 | 180 | app.post( 181 | "/calculatehash", 182 | upload.single("certificate"), 183 | catchAsync(async (req, res, next) => { 184 | if (!req.file) { 185 | throw new createHttpError.BadRequest("file not found"); 186 | } 187 | 188 | const filepath = req.file.path; 189 | const ext = path.extname(req.file.originalname); 190 | 191 | if (ext != ".pdf") { 192 | await fsp.unlink(filepath); 193 | throw new createHttpError.BadRequest("file extension must be .pdf"); 194 | } 195 | 196 | const hash = await sha256(req.file.path); 197 | await fsp.unlink(filepath); 198 | // res.send(`hash: ${hash}`); 199 | res.json({ hash }); 200 | }) 201 | ); 202 | 203 | app.post( 204 | "/issue", 205 | upload.single("certificate"), 206 | catchAsync(async (req, res, next) => { 207 | if (!req.file) { 208 | throw new createHttpError.BadRequest("file not found"); 209 | } 210 | // const hash = await sha256(req.file.path); 211 | const id = uuid(); 212 | const appendedFilePath = path.join(APPENDED_DIR, id + ".pdf"); 213 | await appendUUIDtoPDF(id, req.file.path, appendedFilePath); 214 | const hash = await sha256(appendedFilePath) 215 | const cid = await uploadFileToIPFS(appendedFilePath); 216 | return res.json({ 217 | uuid: id, 218 | hash: hash, 219 | ifpsLink: `https://ipfs.io/ipfs/${cid}/?filename=${id}.pdf`, 220 | cid: cid, 221 | }); 222 | }) 223 | ); 224 | 225 | app.listen(PORT, () => { 226 | console.log(`server started on http://localhost:${PORT}`); 227 | }); 228 | -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "start": "node index.js", 9 | "dev": "nodemon index.js" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "cors": "^2.8.5", 16 | "dotenv": "^16.0.3", 17 | "express": "^4.18.2", 18 | "express-validator": "^6.14.2", 19 | "helmet": "^6.0.1", 20 | "http-errors": "^2.0.0", 21 | "ipfs-http-client": "^60.0.0", 22 | "morgan": "^1.10.0", 23 | "multer": "^1.4.5-lts.1", 24 | "nodemon": "^3.1.3", 25 | "pdf-lib": "^1.17.1", 26 | "uuid": "^9.0.0" 27 | } 28 | } 29 | --------------------------------------------------------------------------------