Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

RPC return value for 0 #1433

Closed
ethers opened this issue Mar 26, 2015 · 2 comments
Closed

RPC return value for 0 #1433

ethers opened this issue Mar 26, 2015 · 2 comments
Assignees

Comments

@ethers
Copy link
Member

ethers commented Mar 26, 2015

return values of 0x00 should be 0x
UPDATE: per comment below zero should be represented as "0x0"

@gavofyork
Copy link
Contributor

according to latest docs:

How to encode types for JSONRPC:
When encoding UNFORMATTED DATA ("byte arrays"): encode as hex, prefix with "0x", two hex digits per byte. Examples:

  • 0x41 (size 1, "A")
  • 0x004200 (size 3, "\0B\0")
  • 0x (size 0, "")
  • WRONG: 0xf0f0f (must be even number of digits - should be 0x0f0f0f)
  • WRONG: 004200 (must be prefixed 0x - should be 0x004200)

When encoding QUANTITIES ("integers", "numbers"): encode as hex, prefix with "0x", the most compact representation (slight exception: zero should be represented as "0x0"). Examples:

  • 0x41 (65 in decimal)
  • 0x400 (1024 in decimal)
  • WRONG: 0x (should always have at least one digit - zero is "0x0")
  • WRONG: 0x0400 (no leading zeroes - should be 0x400)
  • WRONG: ff (must be prefixed 0x - should be 0xff)

@ethers
Copy link
Member Author

ethers commented Mar 27, 2015

what's the link to "latest docs" ? I searched these and didn't see the notes above:
https://github.com/ethereum/wiki/wiki/JSON-RPC
https://github.com/ethereum/wiki/wiki/JavaScript-API

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants