Big shoutout to Rareskills for providing the knowledge, as well as Crypto Fairy's blog on the implementation of the Groth16 algo explanation. Much of the code is lifted from this blog, with a different RICS.
The blog can be found at: https://medium.com/@cryptofairy