Sha256: 374bbd059e59d1b4d31a79e773c06c86f251f84ac47211ddb70e41ecefef2d21

Contents?: true

Size: 870 Bytes

Versions: 27

Compression:

Stored size: 870 Bytes

Contents

[Index](index.md)

Hash ↔ ID Conversion
======================

[Transactions](transaction.md) and [blocks](block.md) are identified by hashes of their binary contents.
In practice these hashes are typically presented as hex-encoded big-endian 256-bit integers which we call *IDs*.
*Transaction ID* and *Block ID* are computed by reversing the bytes of the original binary hash and then encoding it in hex. 

Most of the time, each object that exposes a binary *hash* attribute, also exposes a corresponding *id* attribute.
However, if you need to manually convert a *hash* to *id* or the other way around, use the following methods on the `BTC` object.

Functions
---------

#### BTC.hash\_from\_id(*hex\_string*)

Returns a binary hash string for a given hex string.

#### BTC.id\_from\_hash(*hash*)

Returns a hex-encoded identifier for a given binary hash string.

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
btcruby-1.8 documentation/hash_id.md
btcruby-1.7 documentation/hash_id.md
btcruby-1.6 documentation/hash_id.md
btcruby-1.5.1 documentation/hash_id.md
btcruby-1.5 documentation/hash_id.md
btcruby-1.4 documentation/hash_id.md
btcruby-1.3 documentation/hash_id.md
btcruby-1.2.2 documentation/hash_id.md
btcruby-1.2.1 documentation/hash_id.md
btcruby-1.2 documentation/hash_id.md
btcruby-1.1.6 documentation/hash_id.md
btcruby-1.1.5 documentation/hash_id.md
btcruby-1.1.4 documentation/hash_id.md
btcruby-1.1.3 documentation/hash_id.md
btcruby-1.1.2 documentation/hash_id.md
btcruby-1.1.1 documentation/hash_id.md
btcruby-1.1 documentation/hash_id.md
btcruby-1.0.9 documentation/hash_id.md
btcruby-1.0.8 documentation/hash_id.md
btcruby-1.0.7 documentation/hash_id.md