# Private Voting Contract

### Methods:

By default, these methods can only be called from an address granted the role CONSUMER\_ROLE

***

```
requestCreateBallot(uint256 minimumVoters)
```

Requests the creation of a new ballot.

Successful execution results in the CreateBallotRequested event. `minimumVoters` must be greater than zero. Results in the `CreateBallotFulfilled` event after the ballot is created in space.

***

```
requestVote(bytes32 ballotId, 
            bytes memory encryptedVote)
```

Registers a vote for a particular ballot.&#x20;

Successful execution results in the `VoteRequested` event. Results in the `VoteFulfilled` event after the vote is tabulated in space.

***

```
requestFinalizeBallot(bytes32 ballotId)
```

Requests the finalization (closure and tabulation) of the ballot identified by `ballotId`.

Successful execution results in the `FinalizeBallotRequested` event. Results in the `FinalizeBallotFulfilled` event after the ballot is finalized in space.

### Events:

```
CreateBallotRequested(uint256 indexed requestId,
                      address indexed sender, 
                      uint256 minimumVoters)
```

Signals that a new ballot has been requested.&#x20;

***

```
CreateBallotFulfilled(uint256 indexed requestId,
                      bytes32 indexed ballotId, 
                      bytes publicKey, 
                      uint256 indexed errorCode, 
                      bool callbackSuccess);
```

Signals that a new ballot has been created in space.&#x20;

***

```
VoteRequested(uint256 indexed requestId,
              address indexed sender, 
              bytes32 indexed ballotId, 
              bytes encryptedVote)
```

Signals that an encrypted vote `encryptedVote` has been registered for the unique ballot identifier `ballotId`.

***

```
VoteFulfilled(uint256 indexed requestId,
              bytes32 indexed ballotId, 
              uint256 indexed errorCode,
              bool callbackSuccess)
```

Signals that a vote has been registered in space for the given `ballotId`.

```
FinalizeBallotRequested(uint256 indexed requestId,
                        address indexed sender, 
                        bytes32 indexed ballotId)
```

Signals that a request has been made to finalize the ballot identified by `ballotId`.

```
FinalizeBallotFulfilled(uint256 indexed requestId,
                        bytes32 indexed ballotId, 
                        string result, 
                        uint256 indexed errorCode, 
                        bool callbackSuccess)
```

Signals that the ballot identified by `ballotId` has been finalized in space. **Ballot result is returned in the `result` parameter.**

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cryptosat.io/cryptosat/private-voting/private-voting-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
