internal/proto: Implement write functions