At least under the law as understood in the United States, there is no way to do this.
Generally, at least in the law as understood in the U.S., there is no way to form a contract even close to what you are proposing.
First, you will find authority that says that for there to be a "meeting of the minds". In other words, there must be meaningful agreement on the terms. Your situation expressly calls for them not to know about the agreement and thus fails this test.
Now, it could be pointed out that "meeting of the minds" is older language and many jurisdictions have either abandoned it or interpreted it in ways that focus on objectively manifesting assent to be in a contract rather than actually agreeing. It is not unheard of if people don't read contracts to find out that they have agreed to terms they did not realize they were agreeing to. But no court in any jurisdiction in any time period in history that I am aware of will let someone stumble into a contract without at least having some pretense of an ability to learn all of the terms and then manifestly assenting to them.
Even if that is set aside, Dale M correctly points out that there are other problems. I believe that some of the other problems are even worse form a legal perspective then he suggests.
He correctly points out that contracts for illegal purposes are void. He is right, but he then suggests you might be able to get around it by rephrasing things such as "If you chose to murder with this, we get your soul, but there is no requirement to murder." First, a court would still find that the contract involves an illegal purpose and is immediately void for that reason. Second, that actually raises problems of whether there is consideration for the contract since if the person who acquired the weapon decides to use it for display only the creators are receiving nothing.
He correctly points out that the contract is clearly unconscionable, but suggests that could be removed by making the penalty temporary instead of permanent. I partially agree but partially disagree. Unconscionability is a complicated topic but it is essentially an attempt to avoid blatantly unfair contracts. The word "blatantly" in that sentence is meaningful. The law will allow a certain amount of unfairness. But it will void a contract that it blatantly unfair on policy reasons. Its thus conceivable that the unconscionability could be cured without altering the fundamental nature, but it would have to come much closer to parity than 1 day to 10000 years. Also, the idea that the wielder may not have understood the implications comes in under unconscionability even if there was a way in principle for the wielder to have learned of them.
Finally, he suggests that you could get informed consent through fine print. This is true to a degree and like he says is largely how many online contracts work. But that starts to look like a contract of adhesion, and at the risk of greatly simplifying a very complicated topic, generally with a contract of adhesion if the clause is something that a reasonable person would not expect to be in a contract, that clause is void. In that case, the contract as a whole may exist, but requirements that you surrender your soul or have to commit murder will be void.
No contract that is remotely close to what you describe would ever be found enforceable by any court I am remotely familiar with
You could get somewhat close through a quasi-contract.
Quasi-contracts are a way to avoid unjust enrichment. They are contracts implied by law and can be implied to exist by the conduct of the parties. Under some circumstances, you can find yourself bound by a quasi-contract without intending to enter into one. Quasi-contracts are related to causes of action for unjust enrichment and restitution.
One law-school-style example of a quasi-contract is if you see someone's house is being damaged by heavy rain due to a hole in the roof, find out that the occupants are out, and leap into action to board up the hole, then you are probably entitled to recover the value of your time, effort, and materials used to board up the hole under a theory of quasi-contract or unjust enrichment. The idea is that if the occupant had been there, they certainly would have agreed to pay the value of such services to prevent their property from being badly damaged from the rain, so the law will imply such a contract.
This gets closer to what you want. People can and do wind up in quasi-contracts in the real world without actually agreeing to it in any meaningful way, with no way of knowing the full terms, and without even knowing about it until later.
The problem is that quasi-contracts only allow recovery of what is clearly fair. As long as it does not get into unconscionability, a contract will be enforced even if it is unfair. A quasi-contract is the opposite and a court is not supposed to award more than what is fair in a quasi-contract. Also, quasi-contracts just like regular contracts will not be enforced if they are for an illegal purpose or against public policy. That eliminates just about anything dealing with murder.
Still, you could get closer to what you described this way. If a fabulous sword plainly emblazoned with a demon's sigil appeared to a character every time he needed a sword, and the character then took it and used it, a court might just find that each usage formed a quasi-contract and that at the end the character needed to pay the value of that usage.
Such value would never equal the persons soul and things like the 13th amendment if under U.S. law or similar would cause problems if the demon insisted in being paid in service or similar. But it does allow the character to incur a debt without realizing it while still staying reasonably true to modern day law.
Admittedly, since this is clearly a fantasy setting this is almost redundant, but since my day job is being a lawyer, I should note that nothing I say here or anywhere on StackExchange should ever be viewed as legal advice.