3
Sean Phillips

UI to Authorize Accounts (web3 provider)

@14:50 suggests to create a UI that would allow a user to authorize accounts.

Am I mistaken that this would require you to use a web3 provider other than MetaMask? My understanding is that you cannot reference other ‘Address Objects’ from a MetaMask Web3 provider instance. (web3.eth.accounts[i])

My guess right now is that you would need to rewrite the initWeb3 function from this example to make this work properly, but I’m willing to bet there is a better way of handling this.

Thank you!

Answers

  1. 3
    Jack Wu
    Jack Wu

    Hi Sean,

    The video mentions that you can create a UI to authorize voters. This means that for the frontend webapp, imagine there is a login for the admin for the election. Then user’s of your web app can also create an account or use a form to request permission to vote. Then when the admin logs in, he/she can see a list of people requesting permission to vote and click an “authorize” button for example to authorize people to vote. The admin would still use his/her metamask account and send transactions to the smart contract with the same account. The users of the system would have their own meta mask instance running and have their own unique address/key. The suggestion is not for you to create multiple metamask accounts and handle them yourself. It’s more of a suggestion to create a UI for the admin of the election to see a list of address and authorize them more easily. For example, you can create a “authorize all” button. I hope this helps.

  2. 3
    Sean Phillips

    Jack Wu,

    This is great. A separate ‘admin section’ is what I was considering.

    Thank you!

  3. 3
    Y
    Yun Zhang

    Can someone post the source code for the Truffle UI video?