3

So because I'm doing things from c++, I don't have access to eosjs-ecc.

Assuming that I have successfully packed the transactions (using fcbuffer, packed the action data using the ABI), which I've compared with that of eosjs and they seem to be identical, how does the signing process work?

I have heard that it's

sig = secp256k1(privateKey, sha256(chain_id + packed_transaction + sha256(contextFreeData)))

but the sig output I see in the json has the prefix SIG_K1 and even without that, it's longer than the base58 encoded version of what I outputted. Not only that, the results are different.

I'm in the process of reverse engineering eosjs-ecc and seeing what it does, but I was wondering if anyone happens to know how exactly it is done?

  • signing a transaction means you are providing right permissions, so if you are sending a transaction within a action, then u must be using transaction object which takes the account names with right permissions and those permission u have to set manually. HTH. – Rajat Chaudhary Aug 13 '18 at 8:01
  • What kind of output are you getting when you sign? It's not coming out in Hex is it? – John Haager Aug 14 '18 at 22:10
  • I found what it was. Problem is I can't get the right signature, which is another set of headaches – kamziro Aug 15 '18 at 1:43
  • If you're doing tx signing in C++, would this not be covered in cleos or something like that? – John Williamson Aug 15 '18 at 3:37
  • Cleos connects to keosd to sign the transactions. I want to do it from my own process, in case keosd is not available (e.g in an iOS app) – kamziro Aug 15 '18 at 4:24
2

Whoop, turns out it was "SIG_K1_" + base58check(65 bits of the signature)

Getting the proper 65 bits is another headache for now, but yeah

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.