An optical fingerprint apparatus, applied to an electronic device having a display screen, wherein the optical fingerprint apparatus is configured to be disposed under the display screen, and the optical fingerprint apparatus comprises: an optical fingerprint chip comprising a sensing array having a plurality of optical sensing units, wherein the sensing array is configured to receive a fingerprint light signal returned from a finger above the display screen, and the fingerprint light signal is used to obtain a fingerprint image of the finger; and a light blocking layer, wherein the light blocking layer is a light blocking film layer formed on the upper surface of the edge region of the optical fingerprint chip through a screen printing process or a spray coating process, and the light blocking layer partially blocks the edge region of the optical fingerprint chip and does not block a sensing region of the optical fingerprint chip, and the light blocking layer is configured to block interference light entering the sensing array from the edge region of the optical fingerprint chip, wherein the sensing region is a region where the sensing array is located; and a filter layer disposed on an upper surface of the optical fingerprint chip, wherein the filter layer covers at least the sensing region, and the light blocking layer coats an edge region of the filter layer to avoid the formation of a gap between the light blocking layer and the filter layer; wherein the optical fingerprint apparatus further comprises a circuit board disposed under the optical fingerprint chip and electrically connected to the optical fingerprint chip, a first foam structure and a second foam structure are provided at outer sides of the optical fingerprint chip and arranged between the display screen and the circuit board, a width of the first foam structure is greater than a width of the second foam structure so as to form a blocking portion at one end of the first foam structure, and the blocking portion partially blocks the light blocking layer and does not block the sensing region of the optical fingerprint chip. an optical fingerprint chip comprising a sensing array having a plurality of optical sensing units, wherein the sensing array is configured to receive a fingerprint light signal returned from a finger above the display screen, and the fingerprint light signal is used to obtain a fingerprint image of the finger; and a light blocking layer, wherein the light blocking layer is a light blocking film layer formed on the upper surface of the edge region of the optical fingerprint chip through a screen printing process or a spray coating process, and the light blocking layer partially blocks the edge region of the optical fingerprint chip and does not block a sensing region of the optical fingerprint chip, and the light blocking layer is configured to block interference light entering the sensing array from the edge region of the optical fingerprint chip, wherein the sensing region is a region where the sensing array is located; and a filter layer disposed on an upper surface of the optical fingerprint chip, wherein the filter layer covers at least the sensing region, and the light blocking layer coats an edge region of the filter layer to avoid the formation of a gap between the light blocking layer and the filter layer; wherein the optical fingerprint apparatus further comprises a circuit board disposed under the optical fingerprint chip and electrically connected to the optical fingerprint chip, a first foam structure and a second foam structure are provided at outer sides of the optical fingerprint chip and arranged between the display screen and the circuit board, a width of the first foam structure is greater than a width of the second foam structure so as to form a blocking portion at one end of the first foam structure, and the blocking portion partially blocks the light blocking layer and does not block the sensing region of the optical fingerprint chip.