Today I continued building out the prayer project by adding token functionality to the reactjs project via the abi and address generated in the build file of the truffle project. This was punctured my slow going Rust implementation of cryptopal solutions.
In the morning Ben and I went over setting up truffle and the ganache to create a ERC20 token. It was helpful for me to review what I had learned by teaching another person. And we founds things that neither of us knew. The best though,w was taking a deep dive into the ERC20 documentation (hence the title of this blog post). This raised two questions.
First, where is the documentation that tells us to define the symbol and description variables of a ERC20 Contract? ERC20Details.sol! (Thanks Ben) Second, what is up with the Approve and Allow functions? Why does ERC20 need them? I have read a bunch of different answers that range from: it is because everything on ethereum operates by push notification (there are no listeners), to it is a security measure to make sure that only a certain number of tokens can be transferred by a smart contract execution.
I still don’t have a great intuition around it, but I read this very helpful article, and I think I somewhat get it. It is sort of a a failsafe. I would like to read through the documentation for ERC721 with Ben tomorrow. These sorts of exercises are very useful and rarely are you able to engage with them when you have tight deadlines and just have to sling code.
This afternoon there were fantastic non-programming related presentations about everything from how the democratic party works, to polyamory, to hiking the pct. Fellow recursers are so interesting! I followed this with some cryptopals with Austin and Liz. We discussed different algorithms for implementing a weighting algorithm to figure out which message is most likely to be a plain english message base on word frequency.
One thing we talked about was using the sum of least squares as a weighting algorithm. This I somewhat remembered from my finance days and finding the best fit of a line among a cloud of points. It is the square of the standard deviation. So for example if ‘e’ is found at a .15 frequency and in this message it is found .25 frequency the standard deviation and ‘f’ is found at a .20 frequency and in the message at a .25 frequency. We average the difference so .10 + .05 = .15/2 = .0072 subtract this from each frequency. so .25 – .075 and .25 – .075 then square each result (to get rid of negative numbers). Finally average those out – this is sigma squared or the Variance. When you take the square root, sigma, this is the standard deviation. The standard deviation brings everything back into the same units as your original measurements or quantities.
This reminds me of options trading, where you are trading the volatility rather than the price. That means you are looking at sigma – the standard deviation in stock price. This helps you understand the risk that a option will move X standard deviations away from its current price. But it means that you think there is a bell curve (normal) distribution of prices.
This is not the case! First, there is skew – ie the curve is not symmetrical. You also have kurtosis which describes the distribution at the tails of the curve which also do not follow assumptions that they are 3 standard deviations away – yada yada yada. Both of these could be applicable to the word frequency weighting algorithm. Word frequency probably does not follows a bell curve (normal) distribution. There is also the concept of Heteroskedasticity which refers to sigma changing over time. That is, volatility is not constant over time. I dont think this is applicable our problem of word frequency unless we are looking at messages trying to be deciphered from a long time ago -but then I would just get the word frequency from that moment in time.
I am super exhausted. I wanted to say something about log normal and keeping your volatility between 0 and 1 BUT it is quite possible whatever I just wrote does not make sense, so I am going to hold that thought.
Austin came up with a brilliant idea for the physical implementation portion of the prayer blockchain. It is super cool and I cannot wait to build it. I am going to keep it secret.
And the bookstore from yesterday’s post is topos bookstore and there is another group Patrick told me about is called I/O that hosts radical-tech events at various locations. Thanks again Patrick for telling me about these and sending me the info on zulip!