In this week I spent time doing a deeper reading of the Poseidon [paper](https://eprint.iacr.org/2019/458.pdf). I am currently working on an article that (hopefully) presents a simple explanation with code of the sponge construction and the Hades strategy used in Poseidon. First I will present a general algorithm of the sponge construction, and later, before the end of the week I plan to finish with an explanation of the Hades strategy. In the future I also want to make a discussion on the security and cryptanalisys of Poseidon; however, this is a more involved task and it will depend if it is really necessary to my project.
I already have the following questions that I will try to have an answer by Week 3.
1. How do I make a precompile for the EVM? There are currently nine precompiled contracts, namely, `ecrecover`, `sha256`, `sha3FIPS25`, `ripemd-160`, `Bn128Add`, `Bn128Mul`, `Bn128Pairing`, the identity function, and modular exponentiation; see [here](https://ethereum.stackexchange.com/questions/15479/list-of-pre-compiled-contracts), [here](https://docs.moonbeam.network/builders/pallets-precompiles/precompiles/eth-mainnet/) and [here](https://www.evm.codes/precompiled?fork=shanghai) for more details. Is C a good option to write a precompile? There is a Go implementation in this [link](https://github.com/ethereum/go-ethereum/blob/bd6879ac518431174a490ba42f7e6e822dcb3ee1/core/vm/contracts.go#L51). I will leave this question for later.
2. I still do not know how to make a gas cost analysis. My reading list for this week is to start and finish the readings from [here](https://research.facebook.com/publications/exact-and-linear-time-gas-cost-analysis/) and [here](https://www.research-collection.ethz.ch/handle/20.500.11850/312914). After reading these I hope to have a clearer picture on how to write my project proposal. Some questions I have right now, and for which I expect to have an answer by the end of the week, are: 1) the literature I found about gas cost analysis is related to "normal" smart contracts, but, do these tecniques apply the same way for precompiled contracts?; 2) what is the level of abstraction these analysis tecniques use? do they look at the opcodes or are they based on the higher level languages?; 3) will I managed to do a theoretical and experimental analysis on time by Devconn?.
One of the goals I have with the EPF is to do more applied research and build things. I have been working for some years already on computational complexity, and I always touched cryptography one way or another. Advances in complexity goes hand in hand with advances in cryptographic research. I always liked my ivory tower, but now I feel that I want to go down and touch the grass.
During my studies this week I found something that I really enjoyed playing with, the libraries [`sodium`](https://github.com/jedisct1/libsodium), [`blst`](https://github.com/supranational/blst), and [`secp256k1`](https://github.com/bitcoin-core/secp256k1). I found that most if not all of blockchain networks are based on these three libraries. These are time-tested libraries for cryptographic primitives. One of the arguments against using Poseidon as a precompile is that it hasn't passed the test of time yet. This question, however, cannot be answered before Devconn this year.