{"id":22437025,"url":"https://github.com/blockfrost/blockfrost-websocket-link","last_synced_at":"2025-08-01T15:31:58.071Z","repository":{"id":37962809,"uuid":"347955695","full_name":"blockfrost/blockfrost-websocket-link","owner":"blockfrost","description":"WebSocket link for Blockfrost.io API.","archived":false,"fork":false,"pushed_at":"2024-12-05T10:44:51.000Z","size":542150,"stargazers_count":8,"open_issues_count":8,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-05T11:27:58.209Z","etag":null,"topics":["blockfrost","cardano","websockets"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blockfrost.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-15T12:13:15.000Z","updated_at":"2024-12-05T10:44:56.000Z","dependencies_parsed_at":"2024-10-25T09:19:37.561Z","dependency_job_id":"3b6c57e2-2016-4cfa-9ec1-20d2a16b7ce5","html_url":"https://github.com/blockfrost/blockfrost-websocket-link","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-websocket-link","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-websocket-link/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-websocket-link/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-websocket-link/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blockfrost","download_url":"https://codeload.github.com/blockfrost/blockfrost-websocket-link/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228389159,"owners_count":17912189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockfrost","cardano","websockets"],"created_at":"2024-12-06T00:10:47.812Z","updated_at":"2024-12-06T00:10:48.438Z","avatar_url":"https://github.com/blockfrost.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Made by Five Binaries](https://img.shields.io/badge/made%20by-Five%20Binaries-darkviolet.svg?style=flat-square)](https://fivebinaries.com/)\n\n\u003cimg src=\"https://blockfrost.io/images/logo.svg\" width=\"250\" align=\"right\" height=\"90\"\u003e\n\u003cbr/\u003e\n\n# blockfrost-websocket-link\n\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003eWebSocket link for \u003ca href=\"https://blockfrost.io\"\u003eBlockfrost.io\u003c/a\u003e API.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#about\"\u003eAbout\u003c/a\u003e •\n  \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e •\n  \u003ca href=\"#ui-explorer\"\u003eUI Explorer\u003c/a\u003e •\n  \u003ca href=\"#documentation\"\u003eDocumentation\u003c/a\u003e\n\u003c/p\u003e\n\n## About\n\n**WebSocket Link** is a _server-side application_ that serves as a WebSocket bridge to the Cardano blockchain using the\n**Blockfrost REST API**.\n`blockfrost-websocket-link` is designed to be run in your infrastructure. It can connect to the public **Blockfrost\nREST API** (using your token) or to your own local `blockfrost-backend-ryo` instance.\n\n## Installation\n\n### Dev\n\n`yarn dev`\n\n### Production\n\n`yarn start`\n\n### Nix\n\nThe Nix files are automatically regenerated by `yarn` using the `yarn-plugin-nixify`. You can\nbuild the server by running:\n\n```console\n$ nix-build\n```\n\n## Usage\n\nIn order to start the server, you need to configure some environment variables.\n\n### Required\n\n- `BLOCKFROST_NETWORK`: lets you choose which network it should connect to (_mainnet_ or _testnet_)\n- `BLOCKFROST_PROJECT_ID`: **Blockfrost.io**'s project token\n\n### Optional\n\n- `BLOCKFROST_BACKEND_URL`: URL pointing to your own backend (`blockfrost-backend-ryo`) if you prefer not to use the\n  public **Blockfrost REST API**\n- `BLOCKFROST_BLOCK_LISTEN_INTERVAL`: how often should be the server pulling the backend for new data (in milliseconds,\n  default `5000`)\n- `BLOCKFROST_FIAT_RATES_PROXY`: the proxy used to fetch fiat rates\n- `BLOCKFROST_REQUEST_CONCURRENCY`: the **Blockfrost.io** HTTP API requests limit (default `500`)\n- `BLOCKFROST_SENTRY_DSN`: the **Sentry** data source name to optionally monitor the service\n- `BLOCKFROST_WSLINK_DEBUG`: enables `debug` logging level\n- `BUILD_COMMIT`: provided by `/status` endpoint\n- `METRICS_COLLECTOR_INTERVAL_MS`: frequency for refreshing metrics and performing health check (default `10000`)\n- `PORT`: which port the server should listen to (default `3005`)\n\nOnce your server has started, you can connect to it.\n\n\u003c!-- cSpell: disable --\u003e\n\n```\n$ wscat -c ws://localhost:3005 -n\nConnected (press CTRL+C to quit)\n\u003e {\"id\":0,\"command\":\"GET_SERVER_INFO\",\"params\":{}}\n\u003c {\"id\":0,\"type\":\"message\",\"data\":{\"name\":\"Cardano\",\"shortcut\":\"ada\",\"testnet\":false,\"version\":\"0.14.0\",\"decimals\":6,\"blockHeight\":6576695,\"blockHash\":\"2f82b09b22c54806cd61d83d814151bf11fdcd3fb46af231a5c3ec8c85bbb5e3\"}}\n\u003e {\"id\":1,\"command\":\"GET_BLOCK\",\"params\":{\"hashOrNumber\":\"5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb\"}}\n\u003c {\"id\":1,\"type\":\"message\",\"data\":{\"time\":1506203091,\"height\":null,\"hash\":\"5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb\",\"slot\":null,\"epoch\":null,\"epoch_slot\":null,\"slot_leader\":\"Genesis slot leader\",\"size\":0,\"tx_count\":14505,\"output\":\"31112484745000000\",\"fees\":\"0\",\"block_vrf\":null,\"previous_block\":null,\"next_block\":\"89d9b5a5b8ddc8d7e5a6795e9774d97faf1efea59b2caf7eaf9f8c5b32059df4\",\"confirmations\":6576696}}\n\u003e {\"id\":2,\"command\":\"SUBSCRIBE_BLOCK\",\"params\":{}}\n\u003c {\"id\":2,\"type\":\"message\",\"data\":{\"subscribed\":true}}\n\u003c {\"id\":2,\"type\":\"message\",\"data\":{\"time\":1638458991,\"height\":6576700,\"hash\":\"4f4ebd2246a7c9f61624c6eaf09038d36474ba9be788526637a0d68ccb50ad93\",\"slot\":46892700,\"epoch\":306,\"epoch_slot\":63900,\"slot_leader\":\"pool12g6gfm5c4q7rzwwxdmh0xdxk07tyvujp6d9tke2m46k7q7cz7p0\",\"size\":71037,\"tx_count\":37,\"output\":\"5608976268607\",\"fees\":\"10040718\",\"block_vrf\":\"vrf_vk1tpln5vj8nlgrlxac5t0umc546mqdusvq9y2ldr6k3fjrsjscqhaqtzvcth\",\"previous_block\":\"469de7723eddc90504769cb9e1ef1252c7d84aa0dcdc728d4e3524db923db651\",\"next_block\":null,\"confirmations\":0}}\n\u003c {\"id\":2,\"type\":\"message\",\"data\":{\"time\":1638459043,\"height\":6576701,\"hash\":\"edd0d8eec73a043615fdd51b76c929f2231418bafc976ca0531d497ab5581ce4\",\"slot\":46892752,\"epoch\":306,\"epoch_slot\":63952,\"slot_leader\":\"pool166vvvlk496szmtn4uz6wgcq6djryjk70grpap02yxyspjzkr490\",\"size\":68826,\"tx_count\":42,\"output\":\"2196392602738\",\"fees\":\"10265229\",\"block_vrf\":\"vrf_vk1kmvctdxmaqz8tp04tsdgqrk7vfmdutmyq782rd6yvz3zlugqmezq2kf3yf\",\"previous_block\":\"4f4ebd2246a7c9f61624c6eaf09038d36474ba9be788526637a0d68ccb50ad93\",\"next_block\":null,\"confirmations\":0}}\n\u003c {\"id\":2,\"type\":\"message\",\"data\":{\"time\":1638459047,\"height\":6576702,\"hash\":\"ad9ff078664cc6b56adac63cad3832d9383157d9eb39c742dc4016f54f39a93e\",\"slot\":46892756,\"epoch\":306,\"epoch_slot\":63956,\"slot_leader\":\"pool1cc76kmtcpf6vht32ya5ke9er74dnpy4jh5qpy4klqwp87ygdsu6\",\"size\":58765,\"tx_count\":35,\"output\":\"3219104538435\",\"fees\":\"8369852\",\"block_vrf\":\"vrf_vk182ttxy4dhxyvmkhxd3zac54f5zwqz7hhnvru8prax2udfcsve8dq8m6h68\",\"previous_block\":\"edd0d8eec73a043615fdd51b76c929f2231418bafc976ca0531d497ab5581ce4\",\"next_block\":null,\"confirmations\":0}}\n...\n```\n\n\u003c!-- cSpell: enable --\u003e\n\n## UI explorer\n\nThere is an example UI for this project called [blockfrost-websocket-link-ui](https://github.com/blockfrost/blockfrost-websocket-link-ui)\nand you can find its hosted version at [websocket-link.blockfrost.dev](https://websocket-link.blockfrost.dev/).\n\n## API\n\nAs its name suggests, `blockfrost-websocket-link` provides a WebSocket-based API: the client needs to connect to it\nthrough a WebSocket. Once the WebSocket connection is correctly established the server is immediately ready to accept\ncommands. The communication (both ways) is _JSON encoded_: the server expects JSON encoded messages and will respond\nusing the same encoding.\n\nEach command message requires:\n\n- `id`: an identifier which is mirrored by the server in the output message; This identifier, while unused by the server, is useful for the client to\nreconcile output messages to relative input message.\n- `command`: Command to execute (`ESTIMATE_FEE` | `GET_ACCOUNT_INFO` | `GET_ACCOUNT_UTXO` | `GET_BALANCE_HISTORY` | `GET_BLOCK` |\n`GET_PROTOCOL_PARAMETERS` | `GET_SERVER_INFO` | `GET_TRANSACTION` | `PUSH_TRANSACTION` |\n`SUBSCRIBE_ADDRESS` | `SUBSCRIBE_BLOCK` | `UNSUBSCRIBE_ADDRESS` | `UNSUBSCRIBE_BLOCK`).\n- `params`: optionally a set of parameters, depending on the command.\n\n**The structure of an input message is:**\n\n```ts\n{\n  id: number | string; // Unique identifier for tracking responses\n  \"command\": string;     // Command\n  \"params\": {            // Parameters object based on the command\n    ...\n  }\n}\n```\n\n**General structure of a success response:**\n\n```ts\n{\n  id: number | string; // Unique identifier for tracking responses\n  \"type\": \"message\"\n  data: { // payload\n    ...\n  }\n}\n```\n\n**Structure of an error response:**\n\n```ts\n{\n  id: number | string; // identifier\n  \"type\": \"error\"\n  data: {\n    \"error\": {\n      \"message\": string;\n      // These optional properties below are set in case of BlockfrostServerError or BlockfrostClientError\n      // thrown by blockfrost-js https://github.com/blockfrost/blockfrost-js?tab=readme-ov-file#error-handling\n      \"error\"?: string;\n      \"status_code\"?: number;\n      \"name\"?: number;\n      \"url\"?: number;\n      \"body\"?: unknown;\n    }\n  },\n}\n```\n\n### Request / response commands\n\nFor each of these commands the client receives an immediate response\n\n- [`ESTIMATE_FEE`](#estimate_fee) - estimate transaction submission fee\n- [`GET_ACCOUNT_INFO`](#get_account_info) - get general information about an account\n- [`GET_ACCOUNT_UTXO`](#get_account_utxo) - get unspent UTxOs of an account\n- [`GET_ADA_HANDLE`](#get_ada_handle) - resolves an Ada Handle\n- [`GET_BALANCE_HISTORY`](#get_balance_history) - get balance history of an account\n- [`GET_BLOCK`](#get_block) - get details of a block\n- [`GET_PROTOCOL_PARAMETERS`](#get_protocol_parameters) - get latest epoch protocol parameters\n- [`GET_TRANSACTION`](#get_transaction) - get details of a transaction\n- [`GET_SERVER_INFO`](#get_server_info) - get information about the server\n- [`PUSH_TRANSACTION`](#push_transaction) - submits a transaction to the network\n\n### Subscription commands\n\nEach subscription command immediately responds with a confirmation of the subscription status. Upon successful subscription, the client will receive additional messages whenever the subscribed events occur.\n\nWhen an unsubscribe command is sent, the client receives an immediate response confirming the unsubscribe status. Once successfully unsubscribed, the client will no longer receive messages for those events.\n\n- [`SUBSCRIBE_ADDRESS`](#subscribe_addresses) - subscribe to new transactions for given addresses\n- [`UNSUBSCRIBE_ADDRESS`](#unsubscribe_address) - cancel all new transactions subscriptions\n- [`SUBSCRIBE_BLOCK`](#subscribe_block) - subscribe to new blocks\n- [`UNSUBSCRIBE_BLOCK`](#unsubscribe_block) - cancel new blocks subscription\n\n### ESTIMATE_FEE\n\n**Note: DEPRECATED** - use `min_fee_a` from [`GET_PROTOCOL_PARAMETERS`](#get_protocol_parameters) instead.\n\nEstimates the minimum fee required for transaction submission based on the linear fee parameters for the current epoch.\n\nInput message:\n\n```ts\n{\n  id: number | string; // identifier\n  \"command\": \"ESTIMATE_FEE\"\n}\n```\n\nResponse:\n\n```TypeScript\n{\n  id: number | string;\n  type: \"message\";\n  data: {\n    //The linear factor for the minimum fee calculation for given epoch (min_fee_a)\n    // https://docs.cardano.org/about-cardano/explore-more/parameter-guide/#a-list-of-updatable-protocol-parameters\n    lovelacePerByte: number;\n  }\n}\n```\n\n### GET_ACCOUNT_INFO\n\nRetrieves the account details such as current balance, basic staking information, list of used addresses, paginated list of transactions associated with the account (optional) and more.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"GET_ACCOUNT_INFO\";\n  \"params\": {\n    \"descriptor\": string; // account public key in hex (eg. 6d17587575a3b4f0f86ebad3977e8f7e4981faa863eccf5c1467065c74fe3435943769446dd290d103fb3d360128e86de4b47faea73ffb0900c94c6a61ef9ea2)\n    \"details\": 'basic' | 'tokens' | 'tokenBalances' |'txids' | 'txs';\n    \"page\"?: number; // optional, default 1\n    \"pageSize\"?: number; // optional, default 20\n    \"cbor\"?: boolean; // optional, get CBOR representation of transactions\n  }\n}\n```\n\nResponse:\n\n```TypeScript\n{\n  id: number | string;\n  type: \"message\";\n  data {\n    balance: string;\n    addresses?: {\n      change: {\n        address: string;\n        path: string;\n        transfers: number;\n        balance?: string;\n        sent?: string;\n        received?: string;\n      }[];\n      used: {\n        address: string;\n        path: string;\n        transfers: number;\n        balance?: string;\n        sent?: string;\n        received?: string;\n      }[];\n      unused: {\n        address: string;\n        path: string;\n        transfers: number;\n        balance?: string;\n        sent?: string;\n        received?: string;\n      }[];\n    };\n    empty: boolean;\n    availableBalance: string;\n    descriptor: string;\n    tokens?: {\n      unit: string;\n      quantity: string;\n      decimals: number;\n      name?: string | null;\n      ticker?: string | null;\n      fingerprint?: string;\n    }[];\n    history: {\n      total: number;               // total transactions\n      unconfirmed: number;         // unconfirmed transactions\n      transactions?: {             // List of transactions data, available with details set to \"txs\"\n        txUtxos: {                 // https://docs.blockfrost.io/#tag/cardano--transactions/GET/txs/{hash}/utxos\n          hash: string;\n          inputs: {\n            address: string;\n            amount: {\n              unit: string;\n              quantity: string;\n              decimals: number;\n              name?: string | null;\n              ticker?: string | null;\n              fingerprint?: string;\n            }[];\n            tx_hash: string;\n            output_index: number;\n            data_hash: string | null;\n            collateral: boolean;\n          }[];\n          outputs: {\n            address: string;\n            amount: {\n              unit: string;\n              quantity: string;\n              decimals: number;\n              name?: string | null;\n              ticker?: string | null;\n              fingerprint?: string;\n            }[];\n            output_index: number;\n            data_hash: string | null;\n          }[];\n        };\n        txData: { // https://docs.blockfrost.io/#tag/cardano--transactions/GET/txs/{hash}\n          hash: string;\n          block: string;\n          block_height: number;\n          block_time: number;\n          slot: number;\n          index: number;\n          output_amount: {\n            unit: string;\n            quantity: string;\n            decimals: number;\n            name?: string | null;\n            ticker?: string | null;\n            fingerprint?: string;\n          }[];\n          fees: string;\n          deposit: string;\n          size: number;\n          invalid_before: string | null;\n          invalid_hereafter: string | null;\n          utxo_count: number;\n          withdrawal_count: number;\n          mir_cert_count: number;\n          delegation_count: number;\n          stake_cert_count: number;\n          pool_update_count: number;\n          pool_retire_count: number;\n          asset_mint_or_burn_count: number;\n          redeemer_count: number;\n          valid_contract: boolean;\n          cbor?: string;\n        };\n        address: string;\n        txHash: string;\n      }[];\n      txids?: string[];            // List of transaction ids, available with details set to \"txids\"\n    };\n    page: {\n      size: number;\n      total: number;\n      index: number;\n    };\n    misc: {\n      staking: {\n        address: string;\n        isActive: boolean;\n        rewards: string;\n        poolId: string | null;\n        drep: {\n          drep_id: string;\n          hex: string;\n          amount: string;\n          active: boolean;\n          active_epoch: number | null;\n          has_script: boolean;\n        } | null;\n      };\n    };\n  }\n}\n```\n\n### GET_ACCOUNT_UTXO\n\nFetches all unspent transaction outputs (UTXOs) for the specified account.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"GET_ACCOUNT_UTXO\";\n  \"params\": {\n    \"descriptor\": string; // account public key\n  }\n}\n```\n\nResponse:\n\n```TypeScript\n{\n  id: number | string;\n  type: \"message\";\n  data: {\n    address: string;\n    utxoData: {\n      tx_hash: string;\n      tx_index: number;\n      output_index: number;\n      amount: {\n        unit: string;\n        quantity: string;\n        decimals: number;\n        name?: string | null;\n        ticker?: string | null;\n        fingerprint?: string;\n      }[];\n      block: string;\n      data_hash: string | null;\n    };\n    path: string;\n    blockInfo: { // https://docs.blockfrost.io/#tag/cardano--blocks/GET/blocks/{hash_or_number}\n      hash: string;\n      block: string;\n      block_height: number;\n      block_time: number;\n      slot: number;\n      index: number;\n      output_amount: {\n          unit: string;\n          quantity: string;\n      }[];\n      fees: string;\n      deposit: string;\n      size: number;\n      invalid_before: string | null;\n      invalid_hereafter: string | null;\n      utxo_count: number;\n      withdrawal_count: number;\n      mir_cert_count: number;\n      delegation_count: number;\n      stake_cert_count: number;\n      pool_update_count: number;\n      pool_retire_count: number;\n      asset_mint_or_burn_count: number;\n      redeemer_count: number;\n      valid_contract: boolean;\n  };\n  }[];\n}\n```\n\n### GET_BALANCE_HISTORY\n\nCalculates a history of balance changes for an account within a specified date range.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"GET_BALANCE_HISTORY\";\n  \"params\": {\n    \"descriptor\": string; // account public key\n    \"groupBy\": number;\n    \"from\": number;\n    \"to\": number;\n  }\n}\n```\n\nResponse:\n\n```TypeScript\n{\n  id: number | string;\n  type: \"message\";\n  data: {\n    time: number;\n    txs: number;\n    received: string;\n    sent: string;\n    sentToSelf: string;\n    rates?: { [k: string]: number | undefined };\n  }[]\n}\n```\n\n### GET_ADA_HANDLE\n\nResolves an Ada Handle providing the address holding it.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"GET_ADA_HANDLE\";\n  \"params\": {\n    \"name\": string; // Ada Handle name\n  }\n}\n```\n\nResponse output message `data` type:\n\n```ts\n{\n  id: number | string;\n  type: 'message';\n  data: string | null;\n}\n```\n\n### GET_BLOCK\n\nRetrieves detailed information about a specific block using its hash or height.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"GET_BLOCK\";\n  \"params\": {\n    \"hashOrNumber\": number | string; // Block hash or block height\n  }\n}\n```\n\nResponse:\nPayload contains [block data](https://docs.blockfrost.io/#tag/cardano--blocks/GET/blocks/{hash_or_number}).\n\n```ts\n{\n  id: number | string;\n  type: 'message';\n  data: {\n    hash: string;\n    block: string;\n    block_height: number;\n    block_time: number;\n    slot: number;\n    index: number;\n    output_amount: {\n      unit: string;\n      quantity: string;\n    }\n    [];\n    fees: string;\n    deposit: string;\n    size: number;\n    invalid_before: string | null;\n    invalid_hereafter: string | null;\n    utxo_count: number;\n    withdrawal_count: number;\n    mir_cert_count: number;\n    delegation_count: number;\n    stake_cert_count: number;\n    pool_update_count: number;\n    pool_retire_count: number;\n    asset_mint_or_burn_count: number;\n    redeemer_count: number;\n    valid_contract: boolean;\n  }\n}\n```\n\n### GET_PROTOCOL_PARAMETERS\n\nGets the protocol parameters relative to the latest epochs.\n\nInput message:\n\n```ts\n{\n  id: number | string;\n  \"command\": \"GET_PROTOCOL_PARAMETERS\"\n}\n```\n\nResponse:\nPayload contains [protocol parameters](https://docs.blockfrost.io/#tag/cardano--epochs/GET/epochs/latest/parameters).\n\n```TypeScript\n{\n  id: number | string;\n  type: \"message\";\n  data: { // https://docs.blockfrost.io/#tag/cardano--epochs/GET/epochs/latest/parameters\n    epoch: number;\n    min_fee_a: number;\n    min_fee_b: number;\n    max_block_size: number;\n    max_tx_size: number;\n    max_block_header_size: number;\n    key_deposit: string;\n    pool_deposit: string;\n    e_max: number;\n    n_opt: number;\n    a0: number;\n    rho: number;\n    tau: number;\n    decentralisation_param: number;\n    extra_entropy: string | null;\n    protocol_major_ver: number;\n    protocol_minor_ver: number;\n    min_utxo: string;\n    min_pool_cost: string;\n    nonce: string;\n    cost_models: { [key: string]: unknown } | null;\n    cost_models_raw?: { [key: string]: unknown } | null;\n    price_mem: number | null;\n    price_step: number | null;\n    max_tx_ex_mem: string | null;\n    max_tx_ex_steps: string | null;\n    max_block_ex_mem: string | null;\n    max_block_ex_steps: string | null;\n    max_val_size: string | null;\n    collateral_percent: number | null;\n    max_collateral_inputs: number | null;\n    coins_per_utxo_size: string | null;\n    coins_per_utxo_word: string | null;\n    pvt_motion_no_confidence: number | null;\n    pvt_committee_normal: number | null;\n    pvt_committee_no_confidence: number | null;\n    pvt_hard_fork_initiation: number | null;\n    dvt_motion_no_confidence: number | null;\n    dvt_committee_normal: number | null;\n    dvt_committee_no_confidence: number | null;\n    dvt_update_to_constitution: number | null;\n    dvt_hard_fork_initiation: number | null;\n    dvt_p_p_network_group: number | null;\n    dvt_p_p_economic_group: number | null;\n    dvt_p_p_technical_group: number | null;\n    dvt_p_p_gov_group: number | null;\n    dvt_treasury_withdrawal: number | null;\n    committee_min_size: string | null;\n    committee_max_term_length: string | null;\n    gov_action_lifetime: string | null;\n    gov_action_deposit: string | null;\n    drep_deposit: string | null;\n    drep_activity: string | null;\n    pvtpp_security_group: number | null;\n    pvt_p_p_security_group: number | null;\n    min_fee_ref_script_cost_per_byte: number | null;\n  }\n}\n```\n\n### GET_TRANSACTION\n\nReturns information about a specified transaction, optionally with CBOR representation.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"GET_TRANSACTION\";\n  \"params\": {\n    \"txId\": string; // transaction id\n    \"cbor\":? boolean;\n  }\n}\n```\n\nResponse:\nPayload contains [transaction data](https://docs.blockfrost.io/#tag/cardano--transactions/GET/txs/{hash}).\n\n```TypeScript\n{\n  id: number | string;\n  type: \"message\";\n  data: { // https://docs.blockfrost.io/#tag/cardano--transactions/GET/txs/{hash}\n    hash: string;\n    block: string;\n    block_height: number;\n    block_time: number;\n    slot: number;\n    index: number;\n    output_amount: {\n      unit: string;\n      quantity: string;\n      decimals: number;\n      name?: string | null;\n      ticker?: string | null;\n      fingerprint?: string;\n    }[];\n    fees: string;\n    deposit: string;\n    size: number;\n    invalid_before: string | null;\n    invalid_hereafter: string | null;\n    utxo_count: number;\n    withdrawal_count: number;\n    mir_cert_count: number;\n    delegation_count: number;\n    stake_cert_count: number;\n    pool_update_count: number;\n    pool_retire_count: number;\n    asset_mint_or_burn_count: number;\n    redeemer_count: number;\n    valid_contract: boolean;\n    cbor?: string;\n  };\n}\n```\n\n### GET_SERVER_INFO\n\nFetches general information about the server, such as version, network, and the current block height.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"GET_SERVER_INFO\";\n}\n```\n\nResponse:\n\n```TypeScript\n{\n  hostname: string;\n  name: string;\n  shortcut: string;\n  testnet: boolean;\n  version: string;\n  decimals: number;\n  blockHeight: number;\n  blockHash: string;\n}\n```\n\nExample:\n\n```json\n{\n  \"id\": 1,\n  \"type\": \"message\",\n  \"data\": {\n    \"hostname\": \"wslink-backend1\",\n    \"name\": \"Cardano\",\n    \"shortcut\": \"ada\",\n    \"testnet\": false,\n    \"version\": \"2.1.1\",\n    \"decimals\": 6,\n    \"blockHeight\": 11085275,\n    \"blockHash\": \"e958bfd655844f763e7b6613ffbcf17bde09782bb66efaea67ed49e70261439c\"\n  }\n}\n```\n\n### PUSH_TRANSACTION\n\nSubmits a transaction to the network.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"PUSH_TRANSACTION\";\n  \"params\": {\n    \"txData\": string; // CBOR representation of the transaction\n  }\n}\n```\n\nResponse output message:\n\n```ts\n{\n  \"id\": number | string;\n  \"type\": \"message\";\n  \"data\": string; // transaction id\n}\n```\n\n### SUBSCRIBE_ADDRESS\n\nSubscribes to transaction notifications for a specified list of addresses. The event consist of detailed information about a specified transaction, including inputs, outputs and transaction CBOR.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"SUBSCRIBE_ADDRESS\",\n  \"params\": {\n    \"addresses\": string[], // list of bech32 addresses\n    \"cbor\": true           // optional - whether to include transaction CBOR\n  }\n}\n```\n\nConfirmation of a subscription status:\n\n```ts\n{\n  \"id\": number | string;\n  \"type\": \"message\";\n  data: {\n    \"subscribed\": true; // successful subscription confirmation\n  };\n}\n```\n\nEvent:\n\n```ts\n{\n  id: number | string;\n  type: \"message\";\n  data: {\n    address: string;\n    txHash: string;\n    txData: { // https://docs.blockfrost.io/#tag/cardano--transactions/GET/txs/{hash}\n      hash: string;\n      block: string;\n      block_height: number;\n      block_time: number;\n      slot: number;\n      index: number;\n      output_amount: {\n        unit: string;\n        quantity: string;\n        decimals: number;\n        name?: string | null;\n        ticker?: string | null;\n        fingerprint?: string;\n      }[];\n      fees: string;\n      deposit: string;\n      size: number;\n      invalid_before: string | null;\n      invalid_hereafter: string | null;\n      utxo_count: number;\n      withdrawal_count: number;\n      mir_cert_count: number;\n      delegation_count: number;\n      stake_cert_count: number;\n      pool_update_count: number;\n      pool_retire_count: number;\n      asset_mint_or_burn_count: number;\n      redeemer_count: number;\n      valid_contract: boolean;\n      cbor?: string;\n    };\n    txUtxos: {\n      hash: string;\n      inputs: {\n        address: string;\n        amount: {\n          unit: string;\n          quantity: string;\n          fingerprint?: string; // lovelace has no fingerprint\n          decimals: number;\n          ticker?: string | null;\n          name?: string | null;\n        }[];\n        tx_hash: string;\n        output_index: number;\n        data_hash: string | null;\n        collateral: boolean;\n      }[];\n      outputs: {\n        address: string;\n        amount: {\n          unit: string;\n          quantity: string;\n          fingerprint?: string; // lovelace has no fingerprint\n          decimals: number;\n          ticker?: string | null;\n          name?: string | null;\n        }[];\n        output_index: number;\n        data_hash: string | null;\n      }[];\n    };\n  }[];\n}\n```\n\n### SUBSCRIBE_BLOCK\n\nSubscribes to notifications for each new block added to the blockchain.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"SUBSCRIBE_BLOCK\";\n}\n```\n\nConfirmation of a subscription status:\n\n```ts\n{\n  id: number | string;\n  \"type\": \"message\";\n  data: {\n    \"subscribed\": true; // successful subscription confirmation\n  };\n}\n```\n\nEvent message:\n\n```ts\n{\n  id: number | string;\n  type: 'message';\n  data: {\n    // https://docs.blockfrost.io/#tag/cardano--blocks/GET/blocks/latest\n    hash: string;\n    block: string;\n    block_height: number;\n    block_time: number;\n    slot: number;\n    index: number;\n    output_amount: {\n      unit: string;\n      quantity: string;\n    }\n    [];\n    fees: string;\n    deposit: string;\n    size: number;\n    invalid_before: string | null;\n    invalid_hereafter: string | null;\n    utxo_count: number;\n    withdrawal_count: number;\n    mir_cert_count: number;\n    delegation_count: number;\n    stake_cert_count: number;\n    pool_update_count: number;\n    pool_retire_count: number;\n    asset_mint_or_burn_count: number;\n    redeemer_count: number;\n    valid_contract: boolean;\n  }\n}\n```\n\n### UNSUBSCRIBE_ADDRESS\n\nUnsubscribes from transaction notifications for addresses.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"UNSUBSCRIBE_ADDRESS\"\n}\n```\n\nOutput message:\n\n```ts\n{\n  id: number | string;\n  data: {\n    \"subscribed\": false; // successful un-subscription confirmation\n  },\n  \"type\": \"message\"\n}\n```\n\n### UNSUBSCRIBE_BLOCK\n\nUnsubscribes from block event notifications.\n\nInput message:\n\n```ts\n{\n  \"id\": number | string;\n  \"command\": \"UNSUBSCRIBE_BLOCK\"\n}\n```\n\nConfirmation of a subscription status:\n\n```ts\n{\n  id: number | string;\n  type: \"message\";\n  data: {\n    \"subscribed\": false; // successful un-subscription confirmation\n  };\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockfrost%2Fblockfrost-websocket-link","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblockfrost%2Fblockfrost-websocket-link","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockfrost%2Fblockfrost-websocket-link/lists"}