print websocket messages in a textfile

I am doing a PhD in economics and I am currently working on bitcoin. I am trying to understand how senders decide how much fee they include in transactions. Since in a couple decades miners will be rewarded mostly with fees, I think this is an important question. It would be great if I could have data on all the unconfirmed transactions. This would enable me to see, for each transaction, how much fee it includes given the available information, that is how many transactions are already in the mempool and how much fee do those include. Of course I can see those transactions on blockchain.info, for instance, but is there a way I could save them on a file?

Thanks to a very clear video on you tube I can receive the transactions on my browser’s console log using blockchain.info’s websocket but how can I print, let’s say a couple hundred thousands of them, in a textfile?

Could anyone help me? Thank you very much!

Recent Questions – Bitcoin Stack Exchange