I don't know what the usual legal proceedings are to declare bankruptcy, but this is why they have bankruptcy laws and limited company.
Speak to a bankruptcy lawyer. Presumably all of this is your company's debt, not your own personally, and you have not committed fraud or done anything illegal, so hopefully you're in the clear personally. It may even work out that your cofounder is the one who ends up with a black eye on his credit record if he's the majority shareholder and ends up being the person named in the bankruptcy.
You haven't specified what country you're in. I'm guessing US. From the little I know, bankruptcy protections are pretty great over there. In the UK, if you take a company that you're a director of bankrupt, you aren't allowed to be director of another company for 5 years.