Permission Problem

You don't have permission to do that.

Building a simple voting app

I’m trying to wrap my head around sending different types of transactions over the network.

In this voting app, users have two possible actions:

Cast a Vote
Add a candidate
How I see it, I can possibly add an extra character to the end of the transaction:

candidateName = candidateName+"#";
byte[] transaction = candidateName.getBytes(StandardCharsets.UTF_8);

Then in the State’s handleTransaction function:

if (transaction.substring(transaction.length - 1) == '#') {
    candidates.add(new String(transaction, StandardCharsets.UTF_8));
} else {
    // increment vote for candidate

Is this the right way to go about this? Any suggestions are much appreciated!

Sign In or Register to comment.