I'm trying to build a Ticket-Office project in one of my courses at the University.

The project uses a backend server (which I'm writing in Golang) and it should be able to deploy and use smart contracts; to be able to create events (concerts and sports for example), tickets for these events, and the ability for the end user to 'purchase' them.

The ticket purchase should be based on smart contract transactions. I already figured out how to connect to the Ropsten test network (where all my contracts will live). My issue is, that I can't figure out how to connect users(those who potentially will want to buy a ticket) Metamask account to my service. I can't find an example for that either.

Any suggestions? Thanks ahead!

  • you can use infura provider
    – Badr Bellaj
    Jul 13, 2019 at 8:52
  • Thanks but I'm still not sure how will it help other users to 'purchase' a ticket. I need a way to somehow connect their metamask accounts to my BE. Jul 13, 2019 at 11:07

1 Answer 1


When you say that you want to connect users' Metamask account to your service, you are actually referring to be able to make Metamask send the transactions(basically sign them using the user's private key and then submit to the network) for the user.

This is achieved using the window.web3 object's provider. The object is injected into the browser window by Metamask. You can access this object and the provider through JavaScript that gets executed on the browser.

You cannot do the signing using your go server code because the user's private key cannot be exposed and thus should not leave the client side. So the signing should take place in the browser. You have to use some front end code for this purpose. You may be able to do this by serving some JavaScript files from your go server. But in that case mostly you will be stuck with the old web3 version injected by Metamask.

  • Thanks for the explanation! Jul 17, 2019 at 6:50
  • If the answer helped you please accept and upvote it for the community. :)
    – Sanjay S B
    Jul 17, 2019 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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