I'm trying to do a little extra with the ethereum dao tutorial on a private chain with several nodes having different etherbases.

What I did is as follows,

  • I created the contract, sent it some ether.
  • Added some members (around 8). I can see the members and member count fine.
  • I created a proposal.
  • Finally selected the VoteOn method but get Data cant be executed. message.

There is a votes array in Proposal but something doesnt sit well with this line p.votes[p.numberOfVotes]= Vote({inSupport: supportsProposal, voter: msg.sender, justification: justificationText});

EDIT: My goal is to see the votes and justifications. Without the above line, all works well.

Here is a part of the contract

event Voted(uint proposalID, bool position, address voter, string justification);
struct Proposal {
    address recipient;
    uint amount;
    string description;
    uint votingDeadline;
    bool executed;
    bool proposalPassed;
    bool proposalCanRun;
    uint numberOfVotes;
    int remainingVotesToPass;
    int currentResult;
    bytes32 proposalHash;
    Vote[] votes;
    mapping (address => bool) voted;

struct Vote {
    bool inSupport;
    address voter;
    string justification;
function voteOn(
    uint proposalNumber,
    bool supportsProposal,
    string justificationText
    returns (uint voteID)

    Proposal p = proposals[proposalNumber];         // Get the proposal
    if (p.voted[msg.sender] == true) throw;         // If has already voted, cancel
    p.voted[msg.sender] = true;                     // Set this voter as having voted
    p.numberOfVotes++;                              // Increase the number of votes
    if (supportsProposal) {                         // If they support the proposal
        p.currentResult++;                          // Increase score
    } else {                                        // If they don't
        p.currentResult--;                          // Decrease the score


    p.votes[p.numberOfVotes]= Vote({inSupport: supportsProposal, voter: msg.sender, justification: justificationText});   //form vote obj from given data and add vote to vote group 


    // Create a log of this event
    Voted(proposalNumber,  supportsProposal, msg.sender, justificationText);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.