I am so very sorry about your little dog's passing.
I obviously can't tell you what the cause of his death was. Only a necropsy (autopsy) could determine that.
I am making an educated guess however, as when you said he had belly contractions, this reminded me of my own dear dog who passed from hemangiosarcoma. She had a massive internal bleed in her last few hours, and kept contracting her belly muscles. I know this was an instinct to try to get something out of her insides. She was filling up with blood from a spleen tumour which bled out.
If it WAS hemangiosarcoma, then you couldn't have known. Some dogs get this and it can happen very suddenly. There was nothing you could have done to prevent it. And there is no procedure (as yet) to screen for it or diagnose it in the very initial stages.
In my dog's case I did know what it was, as we had it confirmed by ultrasound only a few days earlier. I had her put to sleep early that morning.
But many of them appear fine and fit and well, until they suddenly get a bleeding internal tumour. This can give no warning.
Blessings to your little dog's Soul. He surely is in a better place where there is no pain and will be waiting for you.
I am so sorry you lost your little dog. It would be very difficult to say with certainty what your dog died from. A Vet would have to try to determine the cause by doing a necropsy, you may want to consider. Is there any chance your dog got into something he shouldn't have like old food, plants, some type of poison? It may have been a pancreatitis problem. The only way to try to find out is to seek the help of your Vet.