You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.
I want to create a new account and give private keys to users so they can cast their votes using their private keys. When I am switching accounts from Metamask, [msg.sender] account address also changes. I want to switch the account without Metamask so [msg.sender] can also change the account address. How can I achieve it? I don't want to switch the account address from Metamask.
function vote (uint _candidateId) public {
require(!voters[msg.sender]);
require(_candidateId > 0 && _candidateId <= candidatesCount);
// record that voter has already voted
voters[msg.sender] = true;
// update candidate voteCount
candidates[_candidateId].voteCount ++;
I am new to Ethereum, I am developing a voting app following this example: https://github.com/dappuniversity/election
I want to create a new account and give private keys to users so they can cast their votes using their private keys. When I am switching accounts from Metamask, [msg.sender] account address also changes. I want to switch the account without Metamask so [msg.sender] can also change the account address. How can I achieve it? I don't want to switch the account address from Metamask.
function vote (uint _candidateId) public {
require(!voters[msg.sender]);
require(_candidateId > 0 && _candidateId <= candidatesCount);
// record that voter has already voted
voters[msg.sender] = true;
// update candidate voteCount
candidates[_candidateId].voteCount ++;
I am using Truffle v5.1.4, Solidity v0.5.12, Web3.js v1.2.1, and Ganache
https://i.stack.imgur.com/2UArz.png
The text was updated successfully, but these errors were encountered: