Blockchain Storage Instructions

  1. Generate the PDF media you want and store it locally.
  2. Go to the console, run your python file to convert the PDF to Hex code
    1. In the code, list the filepath for the PDF you wish to convert
    2. Go to your directory where it is stored in the terminal, then run python3 pdf_to_hex.py
  3. For example, this was my output:
    1. Page 1 Hexadecimal String: 546869730a69730a610a746573740a646f63756d656e740a77650a77696c6c0a686176650a636f6e7665727465640a746f0a68657861646563696d616c0a737472696e67732e0a53696e636572656c792c0a5468650a41666768616e0a44414f0a7465616d
    2. Save this output
  4. I created a file called solidity_smart_contract_basic.sol
    1. // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.0;
      
      contract PdfStorage {
          mapping(uint => string) public pdfData;
      
          function storePdf(uint pageNum, string memory hexString) public {
              pdfData[pageNum] = hexString;
          }
      
          function getPdf(uint pageNum) public view returns (string memory) {
              return pdfData[pageNum];
          }
      }
    2. I compile that code using Remix IDE
    3. Once it was compiled, I went to deploy the code
      1. I selected the Injected Provider - Metamask
      2. I made sure on Metamask that I was selecting a production-level network. I chose Ethereum Mainnet as my network.