I have a contract that I want to be legally binding in traditional courts. It assigns rights, and for this I need legalese in the comments to describe the process. What is the best way to make sure that these comments are verifiable?

Solutions that I think might work:

1) Upload the contract to Etherscan for verification. If Etherscan keeps track of the hash of the pasted contract, then great, we can verify.

2) Get a swarm hash of the text with comments, and then after deployment, update the contract with the swarm hash, and then link to it on swarm in the frontend.

Why would one want to put legalese in a smart contract?

While a smart contract guarantees across borders that the terms of the code are enforced, what it does not do is give users legal protection in their jurisdiction if the contract assigns rights. If you assign rights of a copyright to someone for example, there has to be a scope acceptable in law, not just code. Adding an explicit conveyance in text of what a specific function transfers to the user is important for them to have proof that they are legally protected.

  • 1
    Etherscan has an api which allows you to verify the contract once you deploy it to a network. Supported networks include mainnet, ropsten and a few others. Since the comments are part of the bytecode (more precisely, a part of the 64 out of 65 last bytes, which contain the hash of the source code of the contract (which includes your comment of course)), this verification scheme should be good enough for your needs. Nov 23, 2019 at 16:52
  • While deployed byte code usually (but not necessary) contains hash of the sources, Etherscan.io do not verify this hash. Nov 23, 2019 at 17:26

1 Answer 1


There is more to this than the question suggests so I'll just focus on the prose part of the question.

Comments are not compiled into contracts, therefore there will be no record of them in the bytecode. You can, however, create a convincing record of the document contents and acceptance by the parties.

Put the legal prose in a document such as a PDF and hash the document. Store the bytes32 hash of the authoritative prose in the contract as a state variable and have all parties to the contract sign a transaction indicating acceptance.

It may be handy to store the document in a repository somewhere, but it may be sufficient that each party has a copy and a method of proving that their copy is legitimate.

Hope it helps.

  • I will leave this open to see if anything more creative. I suppose if we concur it's probably a solid pattern. I didn't really see the need for this until I started researching my latest project. I don't need to prove anyone's identify, the person buying rights just needs to be able to defend themselves as a rightful owner of what they bought in a court of law. Easy enough to sell someone something in a contract, harder for them to prove I gave them a right. Nov 23, 2019 at 22:50
  • 1
    AFAIK, the 64 out of 65 last bytes in the bytecode contain the hash of the source code of the contract (which includes the comments of course). If I'm right, then your statement there will be no record of them in the bytecode is wrong. Nov 24, 2019 at 13:32
  • Good catch. I forgot the compiler follows a similar strategy and bakes a code hash right into the bytecode. Nov 24, 2019 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.