How are the last 3 fields (period, proposal, ballot) interpreted in the Ballot message? How is the vote encoded into the last byte?


Period is a 32-bit integer, the current period is 10 so you'd encode this as:


Proposal is just the hext bytes of the unencoded proposal hash, so you would b58cdecode the proposal hash and convert that to hex. For Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd you would do:

eztz.utility.buf2hex(eztz.utility.b58cdecode("Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd", new Uint8Array([2, 170])))
// ab22e46e7872aa13e366e455bb4f5dbede856ab0864e1da7e122554579ee71f8

Finally ballot, is either 00 for Yay/Yea, 01 for Nay, 02 for pass. So, if you want to vote yay for proposal Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd The last 37 bytes (3 fields) of the operation would be:


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.