You shouldn't hide your client code because it kills the concent of blockchain and decentralized technology itself.
Technologies such as Bitcoin are unbreakable as long as 51% of computing power (in case of PoW consesus) comes from honest nodes.
In the moment that more than 51% of computing power is corrupted (malicious) then the ledger is not safe.
As many maximalist may suggest if your intent is to build your own blockchain probably you should re-use code that is already written and considered to be safe and add your features step by step.
Writing a DLT is not only about writing bug-less code (that cannot be used to corrupt all the nodes, as you stated in the question) but also efficient consensus mechanisms that cannot be exploited.
PoW stands for Proof of Work.
DLT stands for Distribuited Ledger Technology (which includes Blockchain, Tangles etc.)
Just also to clarify some misconceptions which I've seen going out here.
Solidity is a deterministic language used to write smart contracts inside the blockchain (it is not the language used to code the blockchain itself but the code used for the softwares running inside the blockchain, example: Ethereum)
Taking Ethereum as example there are different implementations of it, geth (golang-ethereum) being the most active. As I told you if you want to create your own blockchain probably you should look to reuse code that is already proven to be solid.
Answering to: "new blockchain are prone to 51% attacks" (this plagues Proof of Work-consensus blockchains mainly): yes this is absolutely true, new born blockchains (or blockchains with low hash-rates) tend to be attacked frequently by renting hashpower (see Bitcoin Private case happened recently or Bitcoin gold). Unfortunately there's no way to prevent this from happening because it's just how Proof of Work consensus work, the only thing that can be done to contain it is that you wait more block confirmations before considering the assets coming from the transaction to be spendable.
Example (names are chosen randomly): I have an online store accepting BTW (coin) coming from Bitcoin Weak's blockchain which is often plagued by 51% attacks, what I do is that although customers transaction was inserted in block number (X) I wait up until block number (X + 100) before allowing him to spend those money in my platform.
Why do I do this? It's because 51% attacks aim to recreate two chains and insert the longer chain later on which deletes the shorter chain (the one where I created the transaction used to buy on your platform) so the longer confirmation blocks I await the more money I force the hacker to spend to keep the 51% hashrate attack going. If his double spend attack consists in spending 100$ but I force him to spend 101$ in electricity (or hashpower rent) then I discourage him to attack the chain and try to double spend in my platform.
Hope this clarified your doubts.