1. You have to set up an account with a stock broker if you want to transact in the stock market.
  2. Open a demat account with a depository with the help of a Depository Participant (DP)

Sources