What is hex_bytes in SigningPayload?

Now I implement this endpoint /construction/payloads, and I’m not sure what this field means “hex_bytes”

https://www.rosetta-api.org/docs/models/SigningPayload.html

1 Like

Hi! It is a hex-encoded string of the payload bytes. The payload bytes should be the raw bytes that is supposed to get signed by the privatekey.

1 Like

So, is that what the following pseudo-code means for callers?
Signature.hex_bytes = getPrivatekey(payload.getAddress()).sign(payload.getHexBytes)

Yup! You’d probably need to do hex.decode(payload.getHexBytes) or some equivalent decoding into bytes before signing it, but that looks right to me.

1 Like

Just want to clarify here @Matt.Yue that any Construction API implementation never has access to private keys. I believe you understand this but just want to over-communicate for other readers!

The getPrivatekey(payload.getAddress()).sign(payload.getHexBytes) will be performed by the caller on their own tooling. You can see an example implementation of this signing logic in our keys package.

1 Like