After struggling with outdated docs and API changes, I figured out how to properly persist peer IDs in modern libp2p.
Uses current API: privateKeyToProtobuf/privateKeyFromProtobuf
Tested with latest versions
Complete working examples
Gist: Libp2p with static peer IDs · GitHub
Hope this saves others the debugging time I went through!