View Source BitcoinCoreClient.Business (BitcoinCoreClient v0.1.3)

Makes the RPC calls and returns the results in bitstring format

Link to this section Summary

Functions

Returns the block corresponding to the hash sent as a parameter

Returns the block corresponding to the block height sent as a parameter

Converts a block height into a block hash

Returns a transaction

Link to this section Functions

Link to this function

get_block_by_hash(block_hash, settings)

View Source
@spec get_block_by_hash(binary(), %BitcoinCoreClient.Rpc.Settings{
  http_module: term(),
  ip: term(),
  password: term(),
  port: term(),
  username: term()
}) :: {:ok, bitstring()} | {:error, binary()}

Returns the block corresponding to the hash sent as a parameter

examples

Examples

iex> "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
...> |> BitcoinCoreClient.Business.get_block_by_hash()
%Block{...}
Link to this function

get_block_by_height(height, settings)

View Source
@spec get_block_by_height(integer(), %BitcoinCoreClient.Rpc.Settings{
  http_module: term(),
  ip: term(),
  password: term(),
  port: term(),
  username: term()
}) :: {:ok, bitstring()} | {:error, binary()}

Returns the block corresponding to the block height sent as a parameter

examples

Examples

iex> 0
...> |> BitcoinCoreClient.Business.get_block_by_height()
%Block{...}
Link to this function

get_block_hash(height, settings)

View Source
@spec get_block_hash(integer(), %BitcoinCoreClient.Rpc.Settings{
  http_module: term(),
  ip: term(),
  password: term(),
  port: term(),
  username: term()
}) :: binary()

Converts a block height into a block hash

examples

Examples

iex> BitcoinCoreClient.Business.get_block_hash(0, settings)
...> "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
Link to this function

get_transaction(id, settings)

View Source
@spec get_transaction(binary(), %BitcoinCoreClient.Rpc.Settings{
  http_module: term(),
  ip: term(),
  password: term(),
  port: term(),
  username: term()
}) :: {:ok, bitstring()} | {:error, binary()}

Returns a transaction

examples

Examples

iex> "50cfd3361f7162b3c0c00dacd3d0e4ddf61e8ec0c51bfa54c4ca0e61876810a9"
...> |> BitcoinCoreClient.Business.get_transaction()
<<x::bitstring>>