{"id":16354,"library":"ethjs-provider-http","title":"Ethjs HTTP Provider","description":"ethjs-provider-http is a minimalist HTTP provider module for interacting with the Ethereum RPC layer, designed to adhere to the `web3` provider specification. It uses the `xhr2` module for its underlying HTTP requests. Released in 2016 and last updated to version 0.1.6 in January 2017, this package is part of the broader `ethjs` ecosystem, which aimed to provide a lightweight alternative to `web3.js` at the time. However, the `ethjs` suite is no longer actively maintained and has largely been superseded by modern Ethereum client libraries such as Ethers.js and the latest versions of Web3.js. There is no ongoing release cadence, and it is primarily of historical interest or for maintaining legacy applications that specifically depend on it. Its key differentiator was its simplicity and a modular approach within the `ethjs` family, but this is now overshadowed by its lack of maintenance and modern feature support.","status":"abandoned","version":"0.1.6","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/ethjs/ethjs-provider-http","tags":["javascript","ethereum","events","rpc"],"install":[{"cmd":"npm install ethjs-provider-http","lang":"bash","label":"npm"},{"cmd":"yarn add ethjs-provider-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add ethjs-provider-http","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally for making HTTP requests to the Ethereum RPC endpoint.","package":"xhr2","optional":false}],"imports":[{"note":"This package is CommonJS-only and does not provide ESM exports. Direct ESM imports will fail.","wrong":"import { HttpProvider } from 'ethjs-provider-http';","symbol":"HttpProvider","correct":"const HttpProvider = require('ethjs-provider-http');"}],"quickstart":{"code":"const HttpProvider = require('ethjs-provider-http');\nconst Eth = require('ethjs-query');\n\n// NOTE: Ropsten is deprecated. Use a current testnet like Sepolia or Goerli,\n// or a mainnet RPC endpoint from a service like Infura or Alchemy.\nconst provider = new HttpProvider('https://mainnet.infura.io/v3/' + (process.env.INFURA_API_KEY ?? ''));\nconst eth = new Eth(provider);\n\neth.getBlockByNumber(45039930, true, (err, result) => {\n  if (err) {\n    console.error('Error fetching block:', err);\n    return;\n  }\n  if (result) {\n    console.log('Block data:', result);\n  } else {\n    console.log('Block not found or null result.');\n  }\n});","lang":"javascript","description":"This example demonstrates how to instantiate an `HttpProvider` and use it with `ethjs-query` to fetch block information from an Ethereum RPC endpoint. It highlights the CommonJS `require` syntax used by the library."},"warnings":[{"fix":"Migrate to `ethers.js` (`new ethers.providers.JsonRpcProvider('URL')`) or `web3.js` (`new Web3(new Web3.providers.HttpProvider('URL'))`).","message":"This package is no longer actively maintained or developed. The last publish to npm was in January 2017, and the underlying `ethjs` ecosystem is largely inactive. It is highly recommended to migrate to modern, actively maintained libraries like Ethers.js or Web3.js for new projects.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Always use current, supported Ethereum networks (e.g., Sepolia, Goerli for testnets) and up-to-date RPC endpoints from services like Infura, Alchemy, or your own node.","message":"The example code, and the library itself, often references deprecated Ethereum testnets like Ropsten. These networks are no longer active or supported by most RPC providers, leading to connection failures or incorrect data.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use contemporary Ethereum client libraries that actively implement and maintain compatibility with the latest RPC standards and Ethereum evolution.","message":"Compatibility with modern Ethereum JSON-RPC specifications (e.g., EIP-1193 provider interface) and newer client features is not guaranteed due to the package's age and lack of updates.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Prioritize using well-maintained and actively audited libraries from reputable organizations within the Ethereum ecosystem.","message":"As an unmaintained package, `ethjs-provider-http` may contain unpatched security vulnerabilities. Using it in production environments is not recommended due to potential risks.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure your project or environment is configured for CommonJS, or use the `require` syntax. For modern applications, consider libraries with full ESM support.","message":"This library is strictly CommonJS (`require`) and does not support ES Modules (`import`). Attempting to use `import` syntax will result in errors.","severity":"breaking","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Verify the RPC endpoint URL is correct and active. Ensure any required API keys are included in the URL or headers as per the provider's documentation. Check your network connection.","cause":"The RPC endpoint responded with an HTML error page (e.g., 404 Not Found, 403 Forbidden) instead of a valid JSON-RPC payload, often due to an incorrect or deprecated URL, or missing API key.","error":"Error: Invalid JSON RPC response: \"<html>...\""},{"fix":"Ensure you are using `const HttpProvider = require('ethjs-provider-http');`. If using TypeScript, you might need `const HttpProvider = require('ethjs-provider-http').default;` or custom type declarations if the library doesn't provide them.","cause":"Attempting to use `ethjs-provider-http` after an incorrect import, or in an environment where `require` does not correctly resolve the module.","error":"TypeError: HttpProvider is not a constructor"},{"fix":"Try running Node.js with `--openssl-legacy-provider` flag (e.g., `node --openssl-legacy-provider your-script.js`). This is a temporary workaround; the long-term solution is to use a modern, updated library.","cause":"Older Node.js modules, especially those dealing with cryptography or network protocols, can encounter OpenSSL issues with newer Node.js versions due to changes in cryptographic policies or default algorithms.","error":"ERR_OSSL_EVP_UNSUPPORTED"}],"ecosystem":"npm"}