the hash of the ballot spec
the raw string of the ballot spec
Attempts to retrieve a ballotSpec from S3
the url for the http archive
the hash of the ballot spec
the raw string of the ballot spec
Verify a BallotSpec's hash
The raw string/bytes before JSON.parse
The expected hash as Eth Hex
Whether the ballotSpec matched the expected hash
This will take an Ethereum hex string (or a normal hex string) and output a normal hex string (no '0x' header) or throw an error on a bad hex string.
the hex string.
Create a tx object for an ed25519 delegation
Attempts to deploy the a raw ballot spec to IPFS and the ballot archive
Url for the ballot to be deployed to
the stringified ballot spec
if successful, will return the ballot hash as a string
Return bool based on whether a network has an index contract
Verify an ed25519 self-delegation
eth hex string of the dlgt request
stellar pubkey
64 byte signature as eth hex
This function has been deprecated in favour of more general ed25519SignatureIsValid function in /crypto
Verify a ed25519 signature
eth hex string of the dlgt request
stellar pubkey
64 byte signature as eth hex
This compares ethereum addresses (taking into account case, etc)
Sign a message such that it can be verified with ecrecover
.
Similar to web3.eth.accounts.sign
except that we sign the hash directly.
Hash of a message, as returned by web3.utils.soliditySha3
or similar.
Privkey to sign with.
Takes the network details string returned by the BBFarm contract and returns network specific values
[32b chainId][32b networkId][160b bbFarm addr on foreign network]
containing the chainId, networkId and address of the remote BBFarm
Generate a random hexstring with the requested number of bytes (note: this works around a bug in web3-utils in-browser, so these are not considered cryptographically secure; there might be some bias in the distribution of bytes - particularly a statistical lack of 0s)
number of bytes to generate; returned hexString will be nBytes*2+2 in length
Prepares voteData for a Range3 ballot from an array of votes
Takes an array of numbers which represent the votes to be transformed Format: [1, 2, -1]
Returns an eth hex string of the vote data
Attempts to retrieve a ballotSpec from ipfs and falls back to archive
the http archive url
the hash of the url
the raw string of the ballot spec
Takes in the svNetwork object and returns all relevant addresses
Returns an array of all ballots from a democracy
the hash of the ballot spec
the user's address
-------- todo --------------
Attempts to retrieve a ballotSpec from ipfs and falls back to archive
object containing the information about what ballot to retrieve
global ballot object containing all required ballot information
of the democracy we want to get the ballots from
the id of the token subgroup we want to retrieve
the user's address
---------- todo --------------
Retrieves the sequence number for a proxy voting address on a particular ballot
the voting PK of the voter
the sequence number for the voter to use
Get all ed25519 self delegations from a network.
Like web3.eth.accounts.hashMessage without the envelope.
A message to hash - if it is hex it'll be UTF8 decoded.
The hashed message (using keccak256)
This will convert a hex string to Base32 in the bech32 format WITHOUT a checksum.
The hex string to convert to Base32 - can be an EthHex or plain hex string.
The Base32 version of the hex string.
Turn a hexstring (with or without prefix) to a Uint8Array
Return contract instances and web3 needed for SvLight usage
Config file for all current network
Optional
The SvNetwork object based on netConf
Initialise a Web3 instance based on the window's web3.currentProvider
Object containing the web3 instance and metadata
Check if a raw ballotSpec contains a valid signature for a subgroup
raw string of the ballot spec retrieved from ipfs
boolean value representing if the signature valid
Creates a packed copy of start and end times with submissionBits
Start time in seconds since epoch
End time in seconds since epoch
Submission bits - can be created using mkSubmissionBits
Returns a bn.js
BigNum of the packed values.
Format: [submissionBits(16)][startTime(64)][endTime(64)]
Take the arguments and produce web3 data fitting the submitProxyVote
method.
a BN.js or Hex ballotId
the sequence number to use (0 < sequence < 2^32)
the vote data to use, should be 32 bytes hex encoded
any extra data included with the vote (such as curve25519 pubkeys)
the privkey used to sign
options:
{ proxyReq (bytes32[5]), extra (bytes) } in the required format for submitProxyVote
This combines flags into a finished submissionBits. It also does some validation.
Array of all submission flags to combine. See SV.ballotBox.flags for flag options. All flags must be a power of 2 (which indicates they occupy a single bit in the number when combining).
A 16 bit integer of combined flags.
Generate a packed Ed25519Delegation instruction for use with the smart contract or API
An ethereum address to delegate to
A nonce in hex that is 3 bytes (6 characters as hex)
The hex string (with 0x prefix) of the delegation instruction
Prepares a transaction for sending with the users web3 browser
Returns an object with all fields required to cast the transaction
Resolve an ENS name to an address
Generate the submitEd25519Delegation API URL
The URL for this method
Verify a signed vote to be submitted via proxy as generated by mkSignedBallotForProxy
The ProxyVote object
This object tracks the flags used for SV ballot boxes. They determine the submission methods and whether ballots are tracked as binding, official, or testing.
For more info see docs.secure.vote
Generated using TypeDoc
Attempts to retrieve a ballotSpec from ipfs