“Ethereum- Smart Wedding Contract”

CLARISCO
3 min readJun 17, 2021

In our following post, we will go through the technical implementation details of our “Smart Wedding Contract”. This is the prototype model and this is not a full-featured product.

“Are you more interested? Let you can read about it.”

Intro to This Topic:

Here the project is built by truffle framework and we are using web3 for the front end and metamask is used to communicate the ethereum blockchain.

Execution:

The old marriage contract handles all required functionality that manages the funds and assets. Nowadays we want to make it digital by the way it handles dynamic management of funds and assets.

Deployment of Contract:

First of all to add the spouse wallet addresses (ie) constructor argument to the contract. This is the best way to do it because these addresses never changed.

Upload the Contract:

Why do we upload a written contract while we create a superior digital version?

One of the main reasons is the work is under the legal context. If there is no connection to a plain written legal document.

In the old way, the written contract is signed by hand and this is uploaded as a PDF.

Let us assume by paying for a small file you spend $20+, suppose you want to upload a bigger file. What will you do? Here it costs 100 not 1000 dollars. While storing the file on ethereum, we store only the hash of the file on the blockchain.

Signing up the Contract:

The Smart Wedding Contract is an unsigned state while successfully deploying the contract by uploading the IPFS hash.

To invoke the functionalities the spouses first sign it by using their private keys. And it checks the state of the contract before an invocation. The sign contract function is called by the spouse.

Assets:

A car, house, or even stock is called an asset. Here one of the main things is managed by a marriage contract and some of the following questions clarify.

  1. What happens after getting a divorce?
  2. Who owns what?

Smart contracts enable dynamic asset management. There are any changes in this contract that must be confirmed by a notary.

Divorce:

When does a marriage contract exist? After divorce what happens?

Here the divorce function is invoked by a spouse. Both are agreed to divorce the contract is changed into the state of divorce. And the remaining funds are split in half and are sent to each party.

The contract state is changed into divorced, there is no more interaction in the contract anymore. There is a Not Divorced modifier, the critical function is added and they ensure nothing will be changed later.

Adding Asset:

One of the spouses needs to propose it, to add an asset. Another one needs to approve it. By using this function here a new asset gets created by the spouse. There is a suggestion to add the asset and immediately approve it.

Approving Asset:

When the contract is signed the assets are approved in the same way. It gets added when both of the spouses agree to add it.

Removing an Asset:

To remove assets both parties agree to remove them.

Events:

Many events are made and used by a Dapp(Decentralized Application). In every situation, they are emitted to create a proper log and what happened for the frontend application.

https://clarisco.com/dapp-development-services

--

--