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
3 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
6 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
13 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
20 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
25 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
29 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
19 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
11 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
15 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
17 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
17 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
37 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
20 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
38 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
25 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
0
votes
1answer
35 views

Error when sending multiple transactions

I'm having a weird issue with the code below in that sometimes it works and sometimes it doesn't. It seems more apparent when TRANSACTIONS is set to a larger number. I have had it fail AND pass with ...
0
votes
1answer
13 views

web3.eth.defaultChain returns undefined

Hi I am trying to make a call to the Dai contract in the Kovan testnet using web3.js and have to set the value of web3.eth.defaultChain to 'kovan'. The docs state that the default value for web3.eth....
0
votes
1answer
11 views

How to send the RFID card no read using Raspberry Pi to smart contract so the details can be stored on Ethereum blockchain? [closed]

Raspberry Pi reads an RFID card and has to send the RFID number to the smart contract to check further details related to the RFID number. Based on the details the payment is done and stored on the ...
1
vote
0answers
28 views

EIP712— Sign/Recovery using ethereumJS/Solidity

I've tried to mirror the example as shown: https://github.com/ethereum/EIPs/tree/master/assets/eip-712 However after much attempt at troubleshooting I have been unable to return the correct address ...
0
votes
2answers
37 views

window ethereum networkVersion undefined

I am developing a frontend of my smart contract using Angular 8 and web3 version 1.2.7. When I enter the view my web3 service gets created. In the constructor I check if the window.ethereum object ...
0
votes
1answer
17 views

How to fix “gas required exceeds allowance (9998602) or always failing transaction” web3js error on mainnet?

I'm getting gas required exceeds allowance (9998602) or always failing transaction error on transaction.estimateGas() on mainnet, but it's working ok on kovan. What is the reason of this error? Is ...
0
votes
1answer
22 views

ERC20 Anyone can call approve if knows ABI on contract and my address?

I think I misunderstand something. I'm using a Ganache for developing dApp. I built a default ERC-20 smart-contract. I've built it with truffle. And just for test I write some code in NodeJS: ...
0
votes
2answers
36 views

Error sending transaction to smart contract [closed]

I have problem with this, I'm doing a tutorial about how to interact with blockchain through web3, I get some response from blockchain, but the problem is when I try to send transaction or try to ...

1
2 3 4 5
77