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

1,413 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
133 views

How to make ECDSA signature of (value_1, value_2) with web3 on Python?

I want to call function with four parameters. I know how to create two of them, but the last two is the r and s components of ECDSA signature of (param_1, param_2). I tried this (and a lot of ...
0
votes
2answers
77 views

eth.sendTransaction successful or not?

I sent 1 ETH on a private chain from node1 to node2. >eth.sendTransaction({ from: "0x30278b135d0f5c10eb0684ff18bfd84912ae0f2b", gasPrice: "5000000000", gas: "21000", to: '...
0
votes
0answers
763 views

How do I call my smart contract functions through web3 js?

So I am very new to Blockchain development so sorry in advance! I have deployed a very basic Smart Contract to the Ropsten testnet. I am developing a front-end and from here, I want to withdraw ether/...
0
votes
0answers
86 views

Solidity, Web3 - Invalid number of arguments to Solidity function when I have correct number

I created smart contract and I deployed it on Ropsten network using Truffle. I tested it from Remix and it works. I have there 2 view with a same name checkInputData but different number of parameters....
0
votes
0answers
117 views

Problem with send method in Infura

Newly Infura site has been changed its interface. Before that all methods of our client program was successfully working, but now when I logon to Infura, all whitelists has been removed. I added our ...
0
votes
0answers
95 views

web3.eth.sign vs web3.eth.signTransaction, different or the same?

Does web3.eth.sign do the same thing as web3.eth.signTransaction? For instance, could I sign a transaction with web3.eth.sign? What is happening under the hood with those two methods?
0
votes
1answer
26 views

Which web3js version should I use for getting DApp output?

I'm using web3js(1.0.0-beta.51) and I wrote the simple code that not returned any output and exact application result which I have expected.
0
votes
0answers
43 views

Can read from smart contract but can't write

I have a app.js script that I am trying to use to interact with a smart contract. I can read from the contract however, I cannot write to it. The called method countMessages() returns the correct ...
0
votes
2answers
560 views

No “from” address specified in neither the specified in neither the given options nor the default options

So I already went through this query, but I still couldn't get my doubt solved. Be it any Blockchain Dapp, the same error is coming for me. I used the marriage certificate and kickstart examples. Can ...
0
votes
0answers
21 views

Send Data into BlockChain Network using w3?

HI I want to store my bank information on ethereum network using w3. can anyone help me to send my data //Bank.sol pragma solidity >=0.4.21 <0.6.0; contract Bank { struct User {...
0
votes
0answers
920 views

Transaction receipt is always null in getTransactionReceipt in geth

Following is a promise that i use for getting transaction receipt: function getTransactionReceiptMined(web3Instance, txHash, interval) { const self = this; const transactionReceiptAsync = ...
0
votes
0answers
245 views

How do you set up a Truffle script with Infura as provider?

I'm trying to set up my Truffle scripts to use Infura as a provider. I have the following, which appears to set everything up correctly: const HDWalletProvider = require("truffle-hdwallet-provider");...
0
votes
1answer
114 views

web3-core-method.umd.js:1191 Uncaught (in promise) Error: Transaction has been reverted by the EVM:

Keep getting this error and really not sure what's causing it. Smart contract: contract BasaltStore { // struct of how a document will be stored struct documentStore { // unique id of the ...
0
votes
1answer
221 views

Unlocking account web3.js 1.0 on AWS Lambda

I'm getting following error message when trying to unlock account on AWS Lambda: Error: Node error: {"code":-32601,"message":"The method personal_unlockAccount does not exist/is not available"} ...
0
votes
0answers
467 views

address.replace is not a function

I'm not really sure why this web3 method is being called in my code and why it's not a function apparently. Can anyone help me understand what the issue is here? Unhandled Rejection (TypeError): ...
0
votes
1answer
460 views

I am unable to install web3 on my mac

I tried to install web3 in my mac by using sudo npm install web3 but failed many a times . Please help me to sort this matter out . i am attaching you the exact error that I am facing while running ...
0
votes
1answer
90 views

Cannot read property 'sendEth' of undefined, 'sendEth' is function in smart contract

Hi I'm trying to interact with an Ethereum smart contract but it is always showing "TypeError : Cannot read property 'sendEth' of undefined" where 'sendEth' is a function in my smart contract Here is ...
0
votes
0answers
101 views

Release / Debug build generated json-rpc calls are different

I'm trying to make simple web3 calls in React Native with web3.js, but generated json-rpc calls are different between release / debug builds - IOS/Xcode. Expected behavior const web3 = new Web3(`...
0
votes
0answers
210 views

Metamask not connected with web3.js

if (typeof window.web3 !== 'undefined') { web3 = new Web3(web3.currentProvider); } else { // set the provider you want from Web3.providers window.web3 = new Web3(new Web3....
0
votes
1answer
122 views

web3.eth.personal.unlockAccount requires 3 arguments

I am using following code to unlock an account. web3.eth.personal.unlockAccount(address, password); But I get an error message: Error: Invalid Arguments length: expected: 3, given: 2
0
votes
0answers
125 views

transferFrom function works but approve does not

I'm building an escrow contract and using web3js to interact with it. Currently, I am trying to approve and send an amount of custom ERC20 token from a wallet to the escrow contract. The problem is, ...
0
votes
2answers
454 views

After compiling contract, there is no build directory inside project directory?

After writing 'truffle compile' in terminal , it just give the message i.e. compiling your contracts...and exit, no build directory is formed in Project directory. What is the issue?
0
votes
0answers
56 views

SignTransaction with a private key and sendTransaction with an other account

is it possible to sign a transaction with Alice private key and send the signed transaction using Bob account ?
0
votes
1answer
73 views

how to use backup node in web3 connection?

node1= running on port 8545 => current synced block is 2000, and node2= running on port 3545 => current synced block is latest When i am using web3 into another page and print web3 object it ...
0
votes
1answer
383 views

Query Ethereum Blockchain for functions return value of a Specified Smart Contract

I want to get smart contract functions return value sent by a specified smart contract within a range of blocks. I found a [manual] working method to achieve this: async function getTxsByAccount(...
0
votes
1answer
107 views

Wait a promise end before continue

i try to create a map with (address => bool) with web3js. I want to know if the address is a contract owner. So, i have to call "owners" function in my solidity contract. As you can see below : let ...
0
votes
1answer
410 views

Cannot sign a message with web3js (invalid from address)

So I am trying to create a signature of a string, but I cannot do that, as I always get error stating MetaMask - RPC Error: Error: WalletMiddleware - Invalid "from" address. (code: -32603). I am ...
0
votes
2answers
534 views

web3.eth.getAccounts() never give any output

const deploy = async () => { **var acct = await web3.eth.getAccounts();** console.log("ac", acct); } deploy(); even the console is not getting printed,what could be the reason? ...
0
votes
1answer
364 views

Facing UnhandledPromiseRejectionWarning warning message in web3 infura

So far, I'm trying to get transactions list using web3 & infura by websocket provider. Here is my code const Web3 = require("web3"); const web3 = new Web3(new Web3.providers.WebsocketProvider('...
0
votes
1answer
325 views

Specify an alternative node (IP:Port) for Drizzle, if there is no MetaMask or Web3-enabled browser

Drizzle will automatically use the injected Web3 object. But if there is now Web3 object, Drizzle will try to connect to ws://127.0.0.1:8545'. How to configure Drizzle to connect to Infura.io for ...
0
votes
0answers
259 views

Revert on ERC20.transferFrom

I am getting Error: Returned error: VM Exception while processing transaction: revert when testing MyContract.deposit() Here are simplified versions of my code to highlight where the issue is ...
0
votes
0answers
54 views

Ethereum web3 Browser Only functions

Two of the functions of web3 - web3.eth.accounts.wallet.load - web3.eth.accounts.wallet.save Mentioned in the Doc of web3, these are browser only functions. Already tried to test these function ...
0
votes
0answers
377 views

Web3js: How to check the progress sendSignedTransaction()?

Im using a job queue for the transactions. I need to know progress to inform the users the status of their transaction. I've just tweak this code https://github.com/ethereum/web3.js/issues/1151#...
0
votes
0answers
98 views

Unable to transfer token from one personal account to another

I have created two personal account on private blockchain with geth. This is the balance of one account web3.fromWei(eth.getBalance(eth.accounts[0]), "ether"); 100000000000 And this is of the ...
0
votes
0answers
146 views

unable to deploy contract on rinkeby network

I am trying to deploy my contract to rinkeby test network but unable to do so here is my contract code. pragma solidity ^0.4.17; contract Inbox { string public message; function Inbox(string ...
0
votes
2answers
53 views

Making a data Registry - does reading from other contract view function cost gas?

As known, reading view functions is free, but is it also free if I use it between two contract? Let's say I have a contract Registry which has mapping that stores string => uint, nextly I pay some ...
0
votes
0answers
73 views

Hot to debug a contract method invocation?

Running this code: PrintProofOfWork.methods.printRequested(gcodeHash).send({from: web3.eth.defaultAccount}) .then((result) => { console.log(`result of the invocation: ${...
0
votes
2answers
182 views

web3 erroneously returning error

This is strange. My web3 script to deploy a contract seems to work, but always activates the .on('error', fcn) clause even though there is no error. The message says Transaction has been reverted by ...
0
votes
0answers
112 views

Contract deployment not working anymore

So I have this following code that was working a couple of weeks ago and today I decided to run a few tests and it just doesn't do its job anymore. function approve(rid, guest_wallet, ctr_key, dti, ...
0
votes
0answers
414 views

Web3 is injecting but stilling getting an invalid provider error

I'm injecting web3 with MetaMask, and everything works, but when I make a production build, I notice that it injects web3 alright, but when I try to call a web3 function, it throws `Please provide an ...
0
votes
1answer
228 views

Send Transaction to smart contract using web3 ^1.0.0-beta.41 throws parsing error

I want to send to smart contract using this code : this.myContract.methods.addData(declaration).send({ from: '0x3b0282D31174B927e102bA71d80dF34F4e596Fc4', gas: 12000 ...
0
votes
0answers
195 views

Running out of Gas while deploying contract via web3.js

// contract is storing ABI var instance = contract.new( "0x12", // bytes32 "0x12", // bytes32 [], // array of addresses 11, // uint 11, // uint "...
0
votes
1answer
88 views

Execution gas cost

I use web3 and truffle to get info about my testnet transactions. There are few fields about gas used per transaction, such as: gasPrice, gas, gasUsed. But how to get field 'execution cost'?
0
votes
0answers
81 views

source.setEngine is not a function

So everything worked fine in truffle 4.1.14, but when I upgraded to 5.0.0 I got this error: TypeError: source.setEngine is not a function at Web3ProviderEngine.addProvider (node_modules/web3-...
0
votes
0answers
101 views

Simple Payment Channel contract is not signing payments and returns false

I have deployed the smart contract of Payment channel and every thing is working fine but at the time of closing the channel signature is not being validate. I think passing the arguments in a wrong ...
0
votes
0answers
228 views

To transfer tokens using google cloud function

I am transferring token to the User's wallet when they create account. For that I am using google cloud functions. Here, on the account creation event, tokens will get transferred to the address. My ...
0
votes
0answers
134 views

i am trying to send a signed transaction for my solidity code but i am encounting some error can anyone suggest me the fix?

pragma solidity^0.5.0; import "./TokenSale.sol"; contract Dice{ TokenSale public tokenSale; address tokensaleaddress; struct player_details{ address pAddress; string ...
0
votes
0answers
351 views

Sign a transaction locally and send it

I'm using Infura as my web3 provider, and have MetaMask installed to connect to the blockchain. I'm trying to send a transaction, but have learned that Infura is read-only, and doesn't support the ...
0
votes
1answer
276 views

The geth account new and web3.eth.accounts.create

The geth account new and web3.eth.accounts.create. That both function/command are same are different.To create new account.
0
votes
1answer
507 views

How to Serialize/Deserialize array of bytes?

I'm writing a smart contract and inevitably need to have arrays of bytes as input and output of functions. In remix arrays work just fine but with web3j and web3js there are several issues with arrays ...

1
22 23
24
25 26
29