Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The eth-query npm package is a utility for interacting with Ethereum nodes. It provides a simple interface to make JSON-RPC calls to an Ethereum node, allowing developers to query blockchain data, send transactions, and interact with smart contracts.
Querying Blockchain Data
This feature allows you to query blockchain data such as blocks, transactions, and logs. The code sample demonstrates how to get the latest block using eth-query.
const EthQuery = require('eth-query');
const ethQuery = new EthQuery(provider);
ethQuery.getBlockByNumber('latest', (err, block) => {
if (err) console.error(err);
else console.log(block);
});
Sending Transactions
This feature allows you to send transactions to the Ethereum network. The code sample demonstrates how to send a transaction using eth-query.
const EthQuery = require('eth-query');
const ethQuery = new EthQuery(provider);
const txParams = {
from: '0xYourAddress',
to: '0xRecipientAddress',
value: '0xAmountInWei',
gas: '0xGasLimit'
};
ethQuery.sendTransaction(txParams, (err, txHash) => {
if (err) console.error(err);
else console.log(txHash);
});
Interacting with Smart Contracts
This feature allows you to interact with smart contracts by calling their functions. The code sample demonstrates how to call a smart contract function using eth-query.
const EthQuery = require('eth-query');
const ethQuery = new EthQuery(provider);
const contractAddress = '0xContractAddress';
const data = '0xEncodedFunctionCall';
ethQuery.call({ to: contractAddress, data: data }, (err, result) => {
if (err) console.error(err);
else console.log(result);
});
Web3.js is a comprehensive library for interacting with the Ethereum blockchain. It provides a wide range of functionalities including querying blockchain data, sending transactions, and interacting with smart contracts. Compared to eth-query, Web3.js offers more features and a higher level of abstraction, making it suitable for more complex applications.
Ethers.js is a lightweight library for interacting with the Ethereum blockchain. It provides similar functionalities to eth-query, such as querying blockchain data, sending transactions, and interacting with smart contracts. Ethers.js is known for its simplicity and ease of use, making it a popular choice among developers.
Truffle Contract is a library for interacting with Ethereum smart contracts. It provides a higher-level abstraction for working with contracts, making it easier to deploy, test, and interact with them. Compared to eth-query, Truffle Contract is more focused on smart contract development and testing.
like web3 but for minimalists
var provider = { sendAsync: function(params, cb){/* ... */} }
var query = new EthQuery(provider)
query.getBalance(address, cb)
FAQs
like web3 but for minimalists
The npm package eth-query receives a total of 261,650 weekly downloads. As such, eth-query popularity was classified as popular.
We found that eth-query demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.