OpenComplaintNetwork icon indicating copy to clipboard operation
OpenComplaintNetwork copied to clipboard

how to create more account

Open abdullah-19 opened this issue 4 years ago • 4 comments

There is only 4 accounts of 3 types.

  • super user
  • citizen
  • police Now if I want to promote someone to police from a citizen Or create a new citizen ?

I though creating a new issue would be more nice

abdullah-19 avatar Jun 11 '20 16:06 abdullah-19

I'm new on blockchain, now I watched few videos and they seemed easy to me. To understand it better, I'm playing with some blockchain repo, and the I found this : Screenshot (690) It started with 3 accounts, how can I add more?

I was going through this repo : https://github.com/manki11/DIR_HashHacks/ And after running this, I got this.

Thanks in advance. @upperwal

abdullah-19 avatar Jun 11 '20 21:06 abdullah-19

  1. Refer to Ganache configuration to add more accounts on startup.
  2. Add new options with values "4", "5", ... here:

https://github.com/upperwal/OpenComplaintNetwork/blob/1fd7317b3948fa710fdbd6f2936b82ae761ceb4a/src/Components/Pages/View/view.js#L365-L368

https://github.com/upperwal/OpenComplaintNetwork/blob/1fd7317b3948fa710fdbd6f2936b82ae761ceb4a/src/Components/Pages/Register/register.js#L145-L148

Better if you can create a component around this UI.

If you follow these two steps the code will automatically detect the account using the following code.

https://github.com/upperwal/OpenComplaintNetwork/blob/1fd7317b3948fa710fdbd6f2936b82ae761ceb4a/src/Components/Pages/View/view.js#L173-L179

upperwal avatar Jun 12 '20 05:06 upperwal

When I start truffle develop, and compile and migrate then I get these 10 accounts :

Accounts:
(0) 0xc96b6feba12d961dead3776e630b94c8fe705427
(1) 0x6b261680bf72efb69c902c24c3b63daeca4a6ba0
(2) 0x0c4016b523b2876785853803b76927b7adf30d21
(3) 0x362abb37aff6ff5714ed3b1366948d29bb8f467a
(4) 0xe62e83ca3cfa28cb26b5483a4dd8d91de624babb
(5) 0x623d9f864763eabba92d4c6f57a01a9ddcacdea9
(6) 0x237744b5cbd93fd043a126c8fea14f481a18df1e
(7) 0x5f272612a8019c7adfcf52d9851049a75f8932aa
(8) 0x35270c921bba10b2bb23849542304d3f26038534
(9) 0x0919fd2c289d8d563e7c4946086c3d7dd1e8123f

@upperwal Can I somehow add more accounts ? More than 10 ?

Cause I tried adding in register.js :

<option value="0">Super User</option>
<option value="1">Police</option>
<option value="2">Citizen 1</option>
<option value="3">Citizen 2</option>
<option value="4">Citizen 3</option>
<option value="5">Citizen 4</option>
<option value="6">Citizen 5</option>
<option value="7">Citizen 6</option>
<option value="8">Citizen 7</option>
<option value="9">Citizen 8</option>
<option value="10">Citizen 9</option>
<option value="11">Citizen 10</option>
<option value="12">Citizen 11</option>

More options, but it seems it just picks the n-th account from those 10 accounts I mentioned here.

Works till Citizen 8.

abdullah-19 avatar Jun 12 '20 11:06 abdullah-19

There are only 10 account with index from 0 to 9. So it won't work beyond Citizen 8 which is assigned index 9.

You can follow this guide to increase the default account numbers: https://ethereum.stackexchange.com/questions/63600/get-more-than-10-accounts-in-the-truffle-develop-blockchain

upperwal avatar Jun 12 '20 12:06 upperwal