Irreplaceable to whom?
You may be irreplaceable to the current management, but what if the bankers shut the whole thing down and arrange to transfer the work to the spare firm they also bankroll?
Also, do the current management already know and accept that you are irreplaceable? They aren't going to meet the demands of anyone they don't know is irreplaceable, even if you know you are.
It's very unlikely they would have allowed you to become utterly irreplaceable if they knew you were such, so your first challenge would be to convince them of your irreplaceability. Out of ignorance they may not believe you, or may call you on your play, thinking you are bluffing.
If they are successfully convinced, then this may cause general alarm on their part, especially if they imagine events befalling that can't be solved simply by meeting your demands, such as if you perish suddenly.
And their immediate concern is likely to be to reduce their dependency on you, not just so that they are not hostage to your demands, but so they are not hostage to circumstances either and can assure continuity and resilience of the operation to a basic degree.
To this end, they are likely to introduce another expert into the firm to assess the condition of the code and give an opinion about it all. That will mean they have a copy of the code, and it will also mean you are put on the spot to explain it to someone to a sufficient degree that they accept you can't be replaced - in doing so, giving that person a good head start on replacing you.
Also, if the wage premium you eventually seek is extreme (that is, relative to the rate typically commanded by those doing similar work), once extended over a period of time, and especially once mixed in with any further costs you may impose in bargaining or seeking to protect an extortionate bargaining position, that might buy a considerable amount of world-expert labour to solve their coding problems or to reorganise their operation to eliminate the need for the code.
They are only likely to bear extreme wage premiums over the short-term, and only if they are convinced that you are cooperating to unwind the leverage that has required them to pay that premium.
I'd really think twice about this extortion plot. If you have a grievance for other reasons, then simply leaving will probably impose the greatest possible penalty upon them.
Otherwise, if it is simply a cunning plan to increase your wages dramatically, then your days working there will likely be numbered once you execute this plot, if indeed they retain you at all.
There's also a real risk you will commit criminal offences or incur financial liabilities in the process.
If they double your wage immediately whilst taking away all your security passes and sending a team in to interrogate you about all aspects of the code (which will continue indefinitely until they don't need you), and on the other hand threaten to cancel your entry on this month's payroll and immediately start chasing your assets if you don't comply with your employment contract in the short-term, are you really in a position to repel their force, or will the boot suddenly be on the other foot?