Can anyone say what they are?
- hash: is the Keccak-256 hash of the signed and encoded transaction.
- nonce: is a number incremented by the signer for each transaction, like a counter of all transactions belonging to an account.
- value: the amount of Ether (in Wei) you want to send.
- type: (this must be some internal variable of the core-geth tx pool)
- v: it's the signature's v value used to recover the signature's recovery id later (also called y-parity).
- r: the actual signature (r).
- s: the actual signature (s).
How to decode them?
- The hash cannot be decoded, it's a one-way action.
- Nonce, value, type can be just converted to numerics if you prefer.
The signature is usually concatenated:
"#{r}#{s}#{v}"
# => "f17ebf8bea51ea280883ed8be3efa0112669820993e29a6b5fbbededd57f97d5dda51842d1ed1c81e8716ae25ffc389ec17c2eb1c67e74e092802d9339366e893"
To recover the y-parity from v, you would need the chain ID the transaction was broadcasted on:
# Convert a given `v` value to an ECDSA recovery id for the given
# EIP-155 chain ID.
#
# @param v [Integer] the signature's `v` value
# @param chain_id [Integer] the chain id the signature was generated on.
# @return [Integer] the recovery id corresponding to `v`.
# @raise [ArgumentError] if the given `v` is invalid.
def to_recovery_id(v, chain_id = ETHEREUM)
e = 0 + 2 * chain_id + 35
i = 1 + 2 * chain_id + 35
if [0, 1].include? v
# some wallets are using a `v` of 0 or 1 (ledger)
return v
elsif is_legacy? v
# this is the pre-EIP-155 legacy case
return v - 27
elsif [e, i].include? v
# this is the EIP-155 case
return v - 35 - 2 * chain_id
else
raise ArgumentError, "Invalid v #{v} value for chain ID #{chain_id}. Invalid chain ID?"
end
end
Assuming, you are working on Binance Smart Chain (56):
Eth::Chain.to_recovery_id 0x93, 56
=> 0
(used the ruby eth gem: https://github.com/q9f/eth.rb/blob/33b757c34c53200645444eb8f8797376ae304bb9/lib/eth/chain.rb#L99)