Sha256: bacad91ef7d7a0326a4d04fc2034e28c5bbaa64e24daba3fffd03c978857024d

Contents?: true

Size: 1.57 KB

Versions: 27

Compression:

Stored size: 1.57 KB

Contents

[Index](index.md)

BTC::ScriptHashAddress
=====================

A subclass of [BTC::Address](address.md) that represents an address based on the redeem [script](script.md) (pay-to-script-hash, P2SH).

Initializers
------------

#### new(string: *String*)

Returns a new address by parsing a [Base58Check](base58.md)-encoded string that must represent a valid P2SH address.

#### new(hash: *String*, network: *BTC::Network*)

Returns a new address with a 20-byte binary `hash`.

If `network` is not specified, [BTC::Network.default](network.md#default) is used.

#### new(redeem_script: *BTC::Script*, network: *BTC::Network*)

Returns a new address with a hash of the [BTC::Script](script.md) (so-called “redeem script”).

If `network` is not specified, [BTC::Network.default](network.md#default) is used.


Instance Methods
----------------

#### hash

Returns a 20-byte binary hash stored within the address.

#### to_s

Returns string representation of the address in [Base58Check](base58.md) encoding.

#### network

Returns a [BTC::Network](network.md) instance based on the version prefix of the address (mainnet or testnet).

#### version

Returns an integer value of the one-byte prefix of the address. 5 for mainnet, 196 for testnet.

#### public_address

Returns `self`.

#### p2pkh?

Returns `false`.

#### p2sh?

Returns `true`.

#### script

Returns [BTC::Script](script.md) instance that can be used in the [transaction output](transaction_output.md) to send bitcoins to this address. 

Note: do not confuse this with the “redeem script” that is compressed within the address's *hash*. 

Version data entries

27 entries across 27 versions & 1 rubygems

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