Closed john-osullivan closed 6 years ago
Solved this issue! Just in case somebody comes across this in the future, the key was just over twice as large because it was encoded with go-ethereum/common/hexutils
which both doubles the size and adds two bytes on the front for the 0x
.
There was a fix for both the send and the receive. The way my code was setup made it inconvenient to use the same hexutils
library, so I just used the standard encoding/hex
library:
"data": "0x" + hex.EncodeToString(txHash), "raw": true
signature := hex.DecodeString(res.Data["signature"].(string)[2:])
.Worked like a charm, I'll close this out.
Thanks for this!
I'm trying to make a
geth
node call out to Vault for generating private keys and signing transactions. The key pieces are bridged up, but I'm not getting back signatures of the right size -- test cases are failing saying that the signature has size 132 when it needs size 65. Size 65 also seems correct if the signature formula is two length-32 sequences followed by a recovery byte.This seems like it must be a configuration issue given that you're using it successfully, though. What am I missing here? Probably an encoding issue somewhere down the line.
Detailed Description
I'm connecting
vault-ethereum
to a fork ofquorum
in two key places:/accounts/key#newKey()
- This is already behaving -- Vault generates the keys and, for now, hands them back forquorum
to put into its keystore./crypto/crypto#Sign()
is being called without issue, the data is being signed, but the resulting signatures are too large. My replacement implementation makes a barebones call to this library'ssign
endpoint:The
txHash
is, as you might expect, the already-hashed transaction. I've tried a few different versions of that sign call and run into different bugs."data": txHash
) successfully returns a signature, but it is too large."raw": true
to the call, then the call fails with ahex string without 0x prefix
errortxHash
toappend([]string{"0x"}, string(txHash))
, then the call fails witherror converting input [0x �N�axoCA��t�hnU�J�����#�)���qg�] for field "data": '' expected type 'string', got unconvertible type '[]interface {}'
I've been trying alternate approaches to get around the
hex string without 0x prefix
error, but nothing's working. Would appreciate any guidance!Context
I'm trying to plug
vault-ethereum
into a forked version ofquorum
so that the node can sign transactions without ever actually holding the private keys itself. If this was easy, people could easily spin up nodes without worrying about safely managing the private credentials on them.Environment