Code Monkey home page Code Monkey logo

voting-tools's Introduction

Catalyst Voting Tools

A library and series of executables to aid programmers and users to interact with the voting capabilities of Catalyst.

The "voter-registration" executable creates transaction metadata in the correct format for submission with a transaction, to register a user to vote.

The "voting-tools" creates a snapshot of the voting power of registrations and outputs it as JSON file.

Obtaining

Static binary

A static binary for the "voter-registration" executable is provided. Due to limitations in our cross-compilation infrastructure (specifically, static binaries of postgresql libraries cannot be produced), a static binary cannot be provided for the "voting-tools" executable.

The latest static binary can be found here.

Or built with:

nix build .#voterRegistrationTarball

Build it yourself

With Nix

nix build .#voter-registration -o voter-registration
nix build .#voting-tools -o voting-tools

./voting-tools/bin/voting-tools --mainnet --db-user cardano-node --out-file snapshot.json

How to Register to Vote from Scratch

See Manual.

Development

# Launch a ghcid session for the given target
make dev target=lib:voting-tools
make dev target=exe:voting-tools
make dev target=exe:voter-registration
# Launch a ghci session for the given target
make repl target=lib:voting-tools

voting-tools's People

Contributors

dermetfan avatar disassembler avatar jbgi avatar johnalotoski avatar kderme avatar manveru avatar sevanspowell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

voting-tools's Issues

Unable to create metadata transaction after successful build

I have successfully built the voter-registration-tool and have the binary which outputs the help menu successfully:

[nix-shell:/voter-registration-tool]# ./voter-registration/bin/voter-registration --help
voter-registration - a tool to create vote transactions

Usage: voter-registration --payment-signing-key FILE --payment-address STRING
                          --vote-public-key FILE --stake-signing-key FILE 
                          (--mainnet | --testnet-magic NATURAL) 
                          [--time-to-live WORD64] --out-file FILE
  Create a vote transaction

Available options:
  --payment-signing-key FILE
                           file used to sign transaction
  --payment-address STRING address associated with payment (hard-coded to use
                           info from first utxo of address)
  --vote-public-key FILE   vote key generated by jcli (corresponding private key
                           must be ed25519extended)
  --stake-signing-key FILE stake authorizing vote key
  --mainnet                Use the mainnet magic id.
  --testnet-magic NATURAL  Specify a testnet magic id.
  --time-to-live WORD64    The number of slots from the current slot at which
                           the vote transaction times out. (default: 5000)
  --out-file FILE          File to output the signed transaction to
  -h,--help                Show this help text

[nix-shell:/voter-registration-tool]# 

However whenever I try to build a voting registration transaction I receive a failure:

[nix-shell:/voter-registration-tool]# ./voter-registration/bin/voter-registration --payment-signing-key /priv/wallet/Pool_Wallet/payment.skey   --stake-signing-key /priv/wallet/Pool_Wallet/stake.skey   --vote-public-key /priv/wallet/Pool_Wallet/vote.vkey --payment-address $(cat /priv/wallet/Pool_Wallet/payment.addr)   --mainnet   --out-file /priv/wallet/Pool_Wallet/voter-reg-metadata.txsigned --time-to-live 16400000
voter-registration: Prelude.undefined
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/Err.hs:78:14 in base:GHC.Err
  undefined, called at src/Cardano/CLI/Voting.hs:123:21 in voter-registration-0.1.0.0-8ewluHg54h1C5uodO7hz7s:Cardano.CLI.Voting
  1. Are there some requirements expected to be built and available prior to building the voter-registration-tool?
  2. If these requirements are missing would this not produce an error during the build making it clear it did not actually succeed?

FR - Adding --output-format flag for raw(cbor) metadata output and --nonce flag

Feature-Request:

Adding a --output-format flag with the values: txbody, txsigned and metadata
Adding a --nonce flag to provide custom data instead of fixed value slotHeight

In --output-format metadata mode this would reduce the needed input-flags to:

./voter-registration --payment-address STRING 
                     --vote-public-key FILE 
                     --stake-signing-key FILE 
                     --nonce NONCE 
                     (--mainnet | --testnet-magic NATURAL) 
                     --output-format metadata 
                     --out-file FILE

The metadata out-file format should be binary(cbor) format so it can be attached to a transaction via the cardano-cli transaction build-raw --metadata-cbor-file flag.

This would also be in line with the cardano-hw-cli workflow for voting with hw-wallets, which also generates the metadata-cbor-file in raw(binary) format.

P.S.: Maybe it would also be an idea to rename the --payment-address flag into --rewards-payout-address flag, because maybe --payment-address is misleading here. The transaction including such a voting-registration-metadata can be paid by any wallet.

Tag: @disassembler

Improve Readme for Stake Pool Operators

Hi Guys, just wanted to chime in that it seems the current readme is not clear how a SPO can participate in the full Catalyst Fund2 Voting Process

make build CARDANO_NODE_SOCKET_PATH=state-node-testnet/node.socket \ ./voter-registration-tool/voter-registration/bin/voter-registration \ --payment-signing-key payment.skey \ --stake-signing-key stake.skey \ --vote-public-key vote.pub \ --payment-address "addr_test..." \ --testnet-magic 1097911063 > meta.txsigned

I was wondering if we can improve this? I'll try to play with this and submit a PR if I get any reasonable progress

Thanks,
~ Clark, ADAPH Team

voter-registration tool not working anymore in alonzo-era

The Voter-Registration tool is no longer working with node 1.30.1 and later in the Alonzo-Era. Trying to generate a Catalyst Registration Tx results in the following error message:

$ ./voter-registration --payment-signing-key somepay.skey  --payment-address $(cat somepay.addr) --rewards-address $(cat voting/catalyst-rewards.staking.addr) --vote-public-key voting/vote.pkey --stake-signing-key pledge.staking.skey --cardano-mode --mainnet --out-file voting/catalystregistration.tx

voter-registration: DecoderFailure (LocalStateQuery HardForkBlock (': * ByronBlock (': * (ShelleyBlock (ShelleyEra StandardCrypto)) (': * (ShelleyBlock (ShelleyMAEra 'Allegra StandardCrypto)) (': * (ShelleyBlock (ShelleyMAEra 'Mary StandardCrypto)) ('[] *))))) Query (HardForkBlock (': * ByronBlock (': * (ShelleyBlock (ShelleyEra StandardCrypto)) (': * (ShelleyBlock (ShelleyMAEra 'Allegra StandardCrypto)) (': * (ShelleyBlock (ShelleyMAEra 'Mary StandardCrypto)) ('[] *))))))) ServerAgency TokQuerying QueryIfCurrent (QS (QZ GetCurrentPParams))) (DeserialiseFailure 15 "decodeNS: invalid index 4")

The Catalyst Toolbox Repo (https://github.com/input-output-hk/catalyst-toolbox) do not include a registration signing feature yet, soo.... are we now stuck here?

Allegra era

Cardano Version 1.24.2
Testnet/Mainnet

Doing the voter registration command I am getting the following error

voter-registration: user error (AppShelleyQueryError (EraMismatchError (EraMismatch {ledgerEraName = "Allegra", otherEraName = "Shelley"})))

Adding --allegra-era to the command gives Invalid option

Wrong UTXO calculation with tokens on the payment address

Looks like the current version of the voter-registration tool is having some issues calculating the right amount of lovelaces in the transaction when there are native asset on the payment address. The following error occured on a users tryout:

cardano-cli transaction submit --cardano-mode --mainnet --tx-file vote-registration.tx
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraMary (ApplyTxError [UtxowFailure (UtxoFailure (ValueNotConservedUTxO (Value 35777639 (fromList [(PolicyID {policyID = ScriptHash "98dc68b04026544619a251bc01aad2075d28433524ac36cbc75599a1"},fromList [("hosk",9)])])) (Value 35777639 (fromList []))))])

cardano-signer 1.5.0+ now supports catalyst cip-0036 metadata generation

Just as an info, the new version of cardano-signer 1.5.0 has implemented the upcoming CIP-0036 standard for governance/catalyst multi-delegation of voting-power. It generates the registration cbor hex string or directly the binary cbor file to submit it on chain.

Signing (CIP-36 mode) - Catalyst Voting Registration / VotingPower Delegation

### REGISTER/DELEGATE TO A SINGLE VOTING-KEY

$ cardano-signer sign --cip36 \
      --rewards-address "stake_test1urqntq4wexjylnrdnp97qq79qkxxvrsa9lcnwr7ckjd6w0cr04y4p" \
      --secret-key ../owner.staking.skey \
      --vote-public-key somevote.vkey \
      --nonce 71948552 \
      --out-file catalyst-delegation.cbor

a219ef64a5018182582057758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0010258209be513df12b3fabe7c1b8c3f9fab0968eb2168d5689bf981c2f7c35b11718b2703581de0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f041a0449d908050019ef65a1015840c839244556db17a2df914c7291c891e5abd1bd580de7786d640da9e27983efe86495cbee900eb685c08e367e778bb0860c6e366b9ec715d8fba824ef55c8aa0f

### REGISTER/DELEGATE TO MULTIPLE VOTING-KEYS WITH VOTINGPOWER 10%,20%,70%

$ cardano-signer sign --cip36 \
      --rewards-address "stake_test1urqntq4wexjylnrdnp97qq79qkxxvrsa9lcnwr7ckjd6w0cr04y4p" \
      --secret-key ../owner.staking.skey \
      --vote-public-key ../somevote.vkey \
      --vote-weight 10 \
      --vote-public-key "C2CD50D8A231FBC1444D65ABAB4F6BF74178E6DE64722558EEEF0B73DE293A8A" \
      --vote-weight 20 \
      --vote-public-key "ed25519_pk128c305nw9xh20kearuhcwj447kzlvxdfttkk6uwnrf6qfjm9276svd678w" \
      --vote-weight 70 \
      --nonce 71948552 \
      --out-file catalyst-multidelegation.cbor
      
a219ef64a5018382582099d1d0c4cdc8a4b206066e9606c6c3729678bd7338a8eab9bffdffa39d3df9580a825820c2cd50d8a231fbc1444d65abab4f6bf74178e6de64722558eeef0b73de293a8a1482582051f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b518460258209be513df12b3fabe7c1b8c3f9fab0968eb2168d5689bf981c2f7c35b11718b2703581de0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f041a0449d908050019ef65a1015840ecce4b2e10146857b9f583ce01b10a26726022963d47fd61d0fbb67b543428fa46315d4e35b2ab73e7e15f620883176422a19e780a751d71ac488053365e6402

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.