Questions tagged [web3js]

Javascript API and library for Ethereum To develop applications on Ethereum, you can use the web3 object provided by the web3.js library. Under the hood it communicates to a local node through RPC calls. web3.js works with any Ethereum node, which exposes an RPC layer. https://github.com/ethereum/wiki/wiki/JavaScript-API

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

Event filter not returning correct events web3js

I am trying to filter certain events emitted in the past based on the value of a certain field. The code I have used corresponds to the method specified on the web3js documentation page. However, the ...
0
votes
0answers
9 views

How to deploy my java web app on ipfs?

How to host my java web app onto decentrailsed network like ipfs as my web need a web server like tomcat to run and serve the dynamic content so how can i install tomcat on ipfs and push my war in it ...
0
votes
1answer
6 views

How is data sent to the front-end by a View function?

I am required to send some data from a view-only function to the front-end. I tried using the standard approach by emitting an event with the required fields. However, when the emit call is placed ...
1
vote
1answer
8 views

How to import the Contract type from the web3.js library?

Here's how I can do that in ethers@4.0.47: import { Contract, ethers } from "ethers"; const contractInstance: Contract = new ethers.Contract(address, abi); But in web3.js@1.2.8 none of the ...
0
votes
0answers
7 views

web3.js error ethjs-query gives out error in write contract functions

Hi I am getting error Error: [ethjs-query] while formatting inputs '[{"0":false}]' for method 'getTransactionReceipt' error: Error: [ethjs-format] hex string '[object Object]' must be an ...
0
votes
0answers
9 views

How to unlock eth account using web3?

Hi I'm trying to unlock an account using web3 but it returns empty error. When I use cli it returns true > personal.unlockAccount(eth.accounts[0]) Unlock account ...
1
vote
2answers
20 views

ERC20 contract not able to transfer large amount of tokens

I am building an ERC20 Token. I want to the decimals properly so that people can do transaction in deciamls also. So, I am trying to transfer 10^21 tokens from my address to another. Minted tokens : ...
2
votes
0answers
16 views

Why does Ethereum use JSON-RPC and not gRPC?

I am fairly new to networking protocols especially JSON-RPC and gRPC as they are not nearly as common in web development as REST. I was reading around and seems like gRPC generally performs better. So ...
0
votes
0answers
26 views

How to send an array of structs from web3js to solidity contract?

I am getting an error when passing (javascript array of objects) from web3js, To solidity function that takes (array of structs) as a parameter. could you help me? below is the code and the error /...
-1
votes
0answers
7 views

Metamask padLeft padding incorrectly/ different from web3js expected?

To Reproduce: With metamask just install it and on the web console run commands below. With web3js library used in browser --> &lt script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3....
0
votes
0answers
18 views

How to deploy huge contracts using web3?

I have a huge contract (which exceeds the default contract code size set in Quorum). I have increased the Code size and Transaction size in the Genesis file to 128Mb. The contract works well when ...
0
votes
0answers
21 views

Kovan transaction never being mined

I have setup an Infura account to send transactions on the kovan network. This is the code I want to use to send ether to another account (current one has 1 ether from a faucet): var Web3 = require('...
0
votes
1answer
28 views

problem help me gas * price + value

I've seen many topics, but I've yet not solved my problem. Please, help me! var EthereumTx=require('ethereumjs-tx').Transaction const Web3=require('web3') const web3 = new Web3('https://rinkeby....
3
votes
0answers
33 views

Unit testing a Solidity Library function with a struct memory argument

I am trying to unit test a Solidity Library contract function using truffle and web3. My simplified Library contract looks like this: pragma solidity >=0.5.16; pragma experimental ABIEncoderV2; ...
1
vote
1answer
26 views

Drizzle cacheSend outputs “cacheSend is not a function” error, but the tx works when using send

I'm using Drizzle and react-hooks in my new open source project, but cacheSend outputs always "cacheSend is not a function" This line of code with send works as expected const stackId = contract....
0
votes
0answers
9 views

Transaction to contract from web3 not working but working from metamask

I have a method in contract to increase totalSupply and only owner can call it. function addTokenToTotalSupply(uint _value) onlyOwner public { require(_value > 0); balances[owner] = ...
0
votes
0answers
12 views

Getting await is only valid in async function error [closed]

var Subspace = require('@embarklabs/subspace'); var Web3 = require('web3'); var provider = 'https://empty-still-silence.quiknode.pro/825a8e186a5ef0306610/'; var web3Provider = new Web3.providers....
0
votes
1answer
25 views

How to connect to my private ethereum network using web3?

I have setup my own private eth network. I wanted to connect to this. So first I have run geth --datadir ./tolotolo --networkid 1115 --port 30304 console 2>>myEth.log It generated geth.ipc ...
0
votes
0answers
16 views

Getting the “VM Exception while processing transaction: revert” error for a pay() function

I'm getting the following error during the testing in Truffle: Error: Returned error: VM Exception while processing transaction: revert It simply says "revert" without the contingency message, ...
0
votes
1answer
14 views

Deploying a smart contract using transaction manager in web3j

I am new to web3j and smart contract deployment. Consider a scenario where a user is too scared to give his wallet credential file or username/password or private key in a piece of code(the code is ...
0
votes
0answers
26 views

Accessing modifier of another smart contract - Role Based Access Control

I am trying to create a simple role based access control system for the contracts I have created. I have two smart contracts, one named Users that stores all of the users details as well as the type ...
0
votes
1answer
18 views

Couldn't get any accounts!, Ethereum client is not configured correctly

I'm running testrpc on the default port 7545. I run truffle console and test with: web3.eth.getAccounts().then( function (result) { return result[0] }); This works fine. According to docs the ...
1
vote
0answers
8 views

Websocket provider reconnects every 1 minute

I'm developing an application on a private Ethereum chain and trying to listen to some events. I wrote a basic indexer script for listening to events and writing them in a database. To listen to the ...
1
vote
2answers
18 views

Non-interactive transactions with Web3 interface

would like to build a blockchain simulator with web3 interface. I use ganache and solidity. my simulator is a microgrid simulator (autonomous energy community) where a house is represented by an eth ...
0
votes
1answer
15 views

How to efficiently query custom token

I have a smart contract with a custom token which holds some data. The Token data is defined in a struct and stored in an array: struct Token { string text; uint256 value; } Token[] public ...
0
votes
1answer
26 views

signing transaction in web3 is not returning msgHash

I am trying to write provble_transfer where owner can pay gas fee for the transaction. Below is the code for signing transaction to my test contact. let rawTransaction = { 'from': ...
1
vote
1answer
40 views

Whats the best way to sign and send a transaction?

Hey I want to send a transaction that has a message embedded in it. I want the most secure way to unlock the personal account. I have full node GETH installed and am using web3.I have a nodejs script ...
0
votes
0answers
24 views

Getting Blockchain Domains From Transaction Hashes

I am compiling a list of some blockchain domains (.eth, .crypto, etc.) and was wondering what would be the best approach. My strategy is to take something like this: https://etherscan.io/address/...
0
votes
1answer
12 views

Connect Frontend to Deployed Contract on Ropsten Testnet

I recently deployed a contract on the Ropsten testnet and am trying to connect my frontend to my deployed contract. I have created a contract instance with my ABI and contract address, however, my ...
0
votes
1answer
21 views

print the smart contract balance using web3

I am trying to print the balance of the smart contracts using web3 but it doesn't show any error but on the client-side application it appears as follows: Your Balance: [object Promise] /contracts/...
0
votes
1answer
20 views

Can a contract auto execute a transaction given certain conditions? [duplicate]

I've tried searching for this question but can't seem to find an answer. There are others asking to auto execute based on an hour interval or other real world check. What I would like to do is have ...
0
votes
0answers
11 views

Connection Error while using web3

I tried to run the code below. But keep getting the Coonection Error. What can I do to fix this? w3 = Web3(Web3.HTTPProvider('HTTP://127.0.0.1:8545')) w3.eth.getBalance("...
0
votes
2answers
15 views

web3 in truffle.js file

I am trying to deploy my contracts with the specific account the user is using instead of hard coding it. But in this code, I get an error as such: Error: Cannot find module 'web3' the truffle-...
0
votes
1answer
19 views

How to find which smart contract forwarded funds to account

I have a website where I need to receiving ETH payments from my users. I have a smart contract that successfully forwards any transactions sent to it to another address (my storage account), and each ...
0
votes
1answer
10 views

1-To-M struct relationship advice *DApp Development

Let's assume that I'm building a property investment DApp. I have two entities involved in the DApp. Those two entities are 1) providers and 2) investors. Right now, a provider is able to offer 1 ...
0
votes
0answers
19 views

TransferFrom - User Experience Examples

Can someone provide some DApp examples where the transferFrom pattern has been implemented and does an at least 'decent' job of providing a good user experience. If not, what is then a convenient way ...
0
votes
0answers
21 views

ERC20 balance Storage Address key - how to tell which key belongs to which wallet address

I am trying to derive changes of account storage by mapping accounts (here, the accounts represent the key address in the ERC20 balances mapping mapping(address => uint256)) to their corresponding ...
2
votes
0answers
16 views

How to get ethereumjs-abi's soliditySHA3 and web3 sign equivalents in ethersjs?

Hello I'd like to create a hash using ethersjs that encodes a number of arguments. I previously used ethereumjs-abi's soliditySHA3 function but not sure which of ethersjs crypto utilities is the ...
0
votes
0answers
19 views

Modifier accessing another smart contract function

I am trying to use a modifier that calls a function from another smart contract to check the type of user that is accessing the function. The user should only be allowed to access the function if ...
1
vote
1answer
18 views

Accessing contract functions from web3 and javascript

I have deployed a contract in a private blockchain using remix and ganache. Now I want to interact with it trough web3 and the console from my browser, but I'm not managing to interact with the ...
0
votes
0answers
8 views

Does creating account with geth command “geth account new” make a new key store holder?

There are multiple ways of creating a ethereum account through geth. geth account new newAcc, _ := am.NewAccount("Creation password"); by importing import "github.com/ethereum/go-ethereum/accounts" ...
1
vote
1answer
14 views

Account created using Web3js wont recieve tokens from Metamask

I am using web3js to create a local account using the following function function makeaccount() { var account = web3.eth.accounts.create(); console.log(account); var ...
0
votes
1answer
12 views

ERC20 Transaction failing due to invalid nonce value

I am trying to send an erc20 transaction but I keep getting an error telling me that the account I'm sending the transaction from has a nonce value of 1 while the tx has a nonce value of 31613. I am ...
0
votes
0answers
19 views

Web3: call the solidity function with the address can't return the expected outcome! (everyone can help?)

solidity code: address public administrator; constructor() public { administrator = msg.sender; } function isAdministrator(address _address) public view returns (bool) { return _address ==...
0
votes
1answer
11 views

How to sign a erc20 contract call with key using web3

I am making a call to the Dai contract on the Kovan testnet to facilitate transactions between any two addresses entered as input. I was able to successfully make read calls but I realized I needed to ...
1
vote
2answers
41 views

Building a mobile DApp without a full node?

I'm new to blockchain and Ethereum and have a few questions: Does Apple's App Store allow mobile DApps other than wallets and browsers? Is it possible to build a mobile DApp that runs on your mobile ...
0
votes
1answer
19 views

UnhandledPromiseRejectionWarning: Error: Returned error: The method eth_sendTransaction does not exist/is not available [duplicate]

var Web3 = require('web3') var url = 'https://rinkeby.infura.io/v3/cadc6b0dc5c54720b973b3720eab5584' var web3 = new Web3(url) var RemixContract = new web3.eth.Contract([ { "constant": ...
0
votes
0answers
26 views

Web3.js Batch Request Limit?

I'm trying out Batch Request provided by web3.js. In the example below I want to test making 300 transactions but i get the error log displayed below. I'm trying to figure out the error log but it ...
0
votes
1answer
33 views

Metamask not returning the current address

I am using web3.eth.getcoinbase() function to get the address of the current account but instead, it returns null. Can someone help me with this? This is the code web3.eth.getCoinbase(function(err, ...
1
vote
1answer
37 views

How to send ethers from multiple accounts to a single recipient?

I want to transfer 1 ETH distributed to three addresses to a single recipient address. How can I achieve this in ethers.js

1
2 3 4 5
77