Interacting with the API

Warning

This API documentation is INCOMPLETE. It contains errors, omissions, etc., and could change drastically at any time.

Connecting to the API

By default, clearblockd will listen on port 4001 for API requests. API requests are made via a HTTP POST request to /api/, with JSON-encoded data passed as the POST body. For more information on JSON RPC, please see the JSON RPC specification.

Terms & Conventions

wallet IDs

An individual Clearwallet user needs a way to identify themselves to clearblockd for things like storing and retrieving their wallet preferences data, and more.

For this purpose, we define the concept of a wallet ID, which is simply the user’s Clearwallet 12-word password, double-hashed with SHA256 and converted to base 64.

Read API Function Reference

get_preferences

get_preferences(wallet_id)

Gets the preferences for a given wallet ID.

Parameters:wallet_id (string) – The wallet ID to retrieve the preferences for.
Returns:A wallet preferences object if the wallet ID had stored preferences, otherwise {} (empty object).

Action/Write API Function Reference

store_preferences

store_preferences(wallet_id, preferences)

Stores the preferences for a given wallet ID.

Parameters:
Returns:

true if the storage was successful, false otherwise.

Objects

The API calls documented can return any one of these objects.

Wallet Preferences Object

An object that stores the Clearwallet preferences for the given wallet ID.

  • num_addresses_used (integer): The number of addresses utilized in the user’s wallet (this determines how many addresses we will deterministically generate when the user logs in).
  • address_aliases (list): A list of zero or objects, with each object having an address string property, being the Viacoin base56 address, and an alias string property, being the textual alias (i.e. nickname) for this address. Using aliases helps make the wallet more user-friendly.