I am moving to Madrid in July where I will work for a Spanish company on an indefinite contract. I already have NIE number because I worked in Spain for two months a few years ago. As far as I understood after arrival all I need to do is to get a Certificado de Empadronamiento by registering on the census register called the padrón at my local Town Hall and open a bank account.
After three months I have an option to work remotely from my home country which is Poland. Actually I can work from any place in the world which I am planning to do. I will be working and travelling at the same time. That is why after three months I want to deregister at the local Town Hall and let them know I am leaving Spain. BUT I will still be employed on an indefinite contract. Will that be legal? Is there a way to do that?
There is also a case with „Instituto Nacional de Seguridad Social" and „Servicio Público de Empleo Estatal" – my employer has to give them my address – can it be my address in Poland? Otherwise can it be my employer’s office address since I will not be in Spain and won’t have any Spanish address?

Thank you for the reply.