/// <summary> /// Generates an account from the private key of the voter and sets the account to the web3 object /// </summary> /// <param name="voterKey">The private key of the voter</param> private void SetAccount(String voterKey) { if (OnlyHexInString(voterKey)) { this.votingAccount = new Account(voterKey); this.web3 = new Web3(this.votingAccount, this.url); this.votingService = new Bvs_backendService(this.web3, this.contractAddress); } }
/// <summary> /// set contract address from user input /// </summary> /// <param name="contractAdress"></param> /// <returns></returns> public bool SetContractAdress(String contractAdress) { // check format if (!OnlyHexInString(contractAdress)) { MessageBox.Show("Wrong format for election adresss (must be hex-string)"); return(false); } // create voting service with new contract adress this.votingService = new Bvs_backendService(web3, contractAdress); return(true); }