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
1answer
21 views

Invalid sender address, failed to deploy a transaction to the blockchain network

Description I'm trying to deploy a contract to rinkeby network, but everytime I like to deploy the contract it throwing error as invalid sender. Compile code const path = require('path'); const fs =...
0
votes
2answers
24 views

invalid number value for power of 18

Using web3js v1.2.1 const contract = new web3.eth.Contract(abi, '0x29...'); const amount = 1 * 10 ** 18; const data = contract.methods.transfer(recipient, amount).encodeABI(); I get error : invalid ...
0
votes
2answers
24 views

Error: Invalid JSON RPC response: “” from web3

I run: geth --rinkeby --rpc --rpcport=8545 --rpcaddr=192.168.1.37 It works in console: geth attach http://192.168.1.37:8545 > eth.syncing false > eth.accounts ["...
0
votes
0answers
13 views

Trying to send ERC20 token with Javascript button without success

I am trying to send an ERC20 token with the following code via web3.js. It was working until a week ago and then it stopped. Am I doing something wrong? Upon clicking it no longer interacts with ...
0
votes
0answers
17 views

getPastEvents undefined(please help)

I had asked this question before. I looked carefully at the exchange section, which I advised, and I think there is no problem with the exchange section. At least in my opinion there is no problem and ...
1
vote
1answer
19 views

Creating a contract instance

Is it generally better to define a contract instance once, then pass it through your components like... class Parent extends React.Component{ constructor(props){ super(props); ...
0
votes
1answer
15 views

TypeError: market.FileViewed is not a function while trying to watch event

I want to watch for fileViewed event and it throws TypeError: market.FileViewed is not a function in marketplace.FileViewed{ ^ My solidity contract: pragma solidity ^0.5.0; contract ...
0
votes
0answers
14 views

cloning div container number of deployed child contracts time and put their data inside div container

Sorry for the silly question. I have a div container "product-card" , I want to loop the number of my deployed smart contracts time. every time when I loop I want to clone this div container and ...
0
votes
0answers
8 views

How can I change the text message on connection request window of metamask?

I want to change the message in connection request window using web3js. I have attached screenshot here. kindly check it.
0
votes
0answers
19 views

Parity Aura - Error: Transaction has been reverted by the EVM

I run the following code against two private blockchains, parity-aura and geth-clique. Why does the parity transaction revert and why does it use 6,000,000gas when it should actually only use about ...
0
votes
0answers
36 views

erc20 transfer SafeMath: subtraction overflow?

I am trying to transfer a erc20 token. const data = contract.methods.transfer(recipient, amount).encodeABI(); const rawTx = { from: sender, nonce: '0x' + count.toString(16), ...
0
votes
0answers
16 views

Ethereum payment processor Nodejs

I'm working on a web project where I need to have the ability to accept crypto payments. Implementing bitcoin was fairly easy as there were api's whom allowed me to directly subscribe to a specific ...
1
vote
2answers
26 views

How do i use .send() to fire methods of my smartcontract?

I have looked alot for information about this and lastly i turn myself to here. I've written a smartcontract and deployed it to Ropsten . I am then using web3.js to interact with my smartcontract, i ...
0
votes
1answer
12 views

Tokens are not being transferred with web3js

i have been using following code for transferring tokens from wallet to another with the use of web3js. async Transfer(eth_address, amount){ let tokenAddress = "...
0
votes
1answer
38 views

web3.js keeps throwing “error: insufficient funds for gas * price + value” on ropsten

I have been chacking around the site for possible solutions but i havent found any that would solve my (probably most basic) error. The account from which i'm sending has around 1 ether and i'm ...
0
votes
0answers
11 views

RSA signature verification: Inputs to Precompile contract

I am trying to verify an RSA signature using Ethereum smart contract. I have some doubts regarding my design. I am using the precompile at address 0X05 to generate s^e mod n, where s is the ...
0
votes
1answer
12 views

methods.myMethod.call not return value I wanted

I am attempt to get an address using methods.call(). And it's something error. JS var rcAddr = "0x683d1602fa7252d49cda8ac414c1641a56e73d03"; var methodName = "Access Control"; var register = new ...
0
votes
1answer
15 views

rpc error with payload and exception thrown in contract code

This is the problem I get when trying to run my contract! And then when I go ahead and run it, this pops up This is my js code: import React, { Component } from 'react'; import Web3 from 'web3'; ...
0
votes
1answer
13 views

Call functions from another account by default in web3

In my truffle tests, I am trying to call a function from an account other than the default account, so not accounts[0] from the below result. web3.eth.defaultAccount doesn't seem to work. web3.eth....
1
vote
0answers
25 views

How to get DAI using Web3.js

I'm building a Web3 app and I'm trying it out on the Kovan testnet. I'm trying to get some DAI. As far as I understand it the way to get DAI is to: Exchange ETH for WETH. Use Sai Tub contract to open ...
0
votes
1answer
29 views

Does using a very high gas limit somehow get your transactions executed slower?

I'm executing transactions on mainnet with a NodeJS script: async function send(web3, transaction, destAddr, gasPrice, privateKey) { const options = { data : transaction.encodeABI(), ...
0
votes
1answer
26 views

Proper way to save a public key as bytes in a contract

I need to save public keys in many contracts. Despite that this choice costs, I store them as bytes (I know that the best way is to split the key and store it to different bytes32 constants, but that ...
0
votes
0answers
28 views

Events using Infura websockets on rinkeby Web3 1.2.1. Returned values aren't valid, did it run Out of Gas?

I am trying to do a simple event listener with NodeJS and Web3 using an Infura endpoint. I have the correct project-id const Web3 = require('web3'); let web3 = new Web3( // Replace YOUR-PROJECT-ID ...
0
votes
2answers
35 views

app.vote(1, {from: web3.eth.accounts[0] }) not working

I am following a tutorial from Dapp University about building Election Smart Contract. When I run this command in the console: app.vote(1, {from: web3.eth.accounts[0] }) I get the following error: ...
0
votes
0answers
16 views

Approving tokens from original contract, how would you do it?

I need to create a general approval for a transferFrom function for an exchange or general contract if you will. I've tried many ways in solidity to reference the old contract, including using tx....
0
votes
0answers
11 views

How to Convert TransactionHash (SendETH) to Variable?

I have created a function to send Ethereum and it can run inside console.log. With a simple code call a function like this: var sendEth = sendMoney(data).then(hash => { console.log(hash....
0
votes
1answer
24 views

I have a huge ᴀʙɪ file in the ᴊꜱᴏɴ fomat but third party’s contract’s code is private. How to generate the list of function selectors?

I have an abi file with lot of functions for a large contract. It would really take a lot of time to generate by hand the hash of each functions/methods. Since the source code isn’t public, how to ...
0
votes
1answer
28 views

end process after web3 sendTransaction return transactionHash

I want to end the process after sendTransaction return transactionHash. Here is my code currently : const Web3 = require('web3'); const web3 = new Web3("http://127.0.0.1:8545"); async function task(...
0
votes
1answer
20 views

web3js later versions. Bundle, how?

I'm trying to build the frontend of a dApp, but the web3js makes my head hurt. I need to include it in my project, but the latest web3.min.js i can find is this. I want to use 1.2.1, and i understand ...
0
votes
1answer
16 views

Why Send Transaction is Error 'exceeds block gas limit'?

Why can't I send Ethereum with a code like this : const Web3 = require('web3') const provider = new Web3.providers.HttpProvider('https://provider') const web3 = new Web3(provider) const account = ...
0
votes
0answers
30 views

Cannot call contract?

ive been trying for days to create a contract and simply call a function on it. Just to learn. But i can for the love of god not figure out what im doing wrong. I got truffle and Ganache set up, and i ...
0
votes
1answer
26 views

How can I Buy or Sell erc20 token with using web3.js? [on hold]

Which function will I use in web3.js for buying erc20 token from my website?
0
votes
1answer
34 views

Unable to install web3 on windows 10

This is the error I get when I try to install web3 on my machine. After installing git I have another issue: C:\Windows\system32> npm install web3 npm ERR! code ENOENT npm ERR! syscall spawn git ...
0
votes
2answers
19 views

validation of data integrity in block

I am learning ethreum dapps development and have developed some dapps. I was thinking about supply chain dapp which i think , is very good application of blockchain as it ensures all the history of a ...
0
votes
1answer
36 views

How can I unlock my account

I cannot unlock my account. I decrypted my account from encrypted accoun, and want to unlock it to deploy contract. However, I am getting this error, Node error: {"code":-32000,"message":"could ...
0
votes
0answers
3 views

Install Web3php In CodeIgniter?

Does anyone know of this error when I install and update web3php with the composer in codeigniter ? Image Here I tried installing it, but it came out like in the picture.
0
votes
1answer
43 views

Node error when I deployed smart contract - Web3.js

I get this error when I deployed smart contract to my private chain. Error: Node error: {"code":-32000,"message":"unknown account"} This is my web3.js code. const bytecode = "...
0
votes
0answers
27 views

How to transfer ERC20 token from one account to another account but paying the transaction fee from third account?

I want to transfer token from account A to account B by paying transaction fee from account C.I have tried the following logic but token transfer from contract to contract mean contract transfer token ...
2
votes
1answer
36 views

MetaMask and it's “speed up transaction feature” — no callback

I'm using MetaMask to make Ethereum transactions from my website, as described here: https://metamask.github.io/metamask-docs/Main_Concepts/Sending_Transactions It works perfectly. I capture the ...
1
vote
0answers
39 views

Web3 - cannot deploy contract to private chain has been reverted [duplicate]

I want to deploy a contract to my private chain by using web3.js, but my contract deployment has been reverted by the EVM. This is error message index.js:1437 Error: Transaction has been reverted ...
1
vote
2answers
25 views

Insufficient funds when transferring ERC-20 token using web3

I am trying to send an ERC-20 token on Mainnet using web3 v1.x and Infura. I get the error in the title while executing this code. I have a balance of about 0.14 ETH var provider = new ...
0
votes
0answers
32 views

Problem accessing variables stored in event log

I have succesfully implemented an event in my contract Portfolio: // Define eventlog for myEvent event myEvent(uint indexed eventDate, address indexed sender, myArray[] eventList, uint eventBalance); ...
0
votes
1answer
29 views

getting full pending transactions from Infura

I use Infura to get all pending transactions from Ropsten: web3.eth.subscribe('pendingTransactions', async (error, txHash) => { let tx = getTransaction(txHash) ... } With this ...
0
votes
1answer
11 views

Unable to interface the contract while running test.js and how to get the abi while compiling using solc?

Solidity Contract: index.sol pragma solidity ^0.5.0; contract Inbox{ string public message; constructor(string memory IntialMessage) public{ message = IntialMessage; } function setMessage(...
0
votes
0answers
7 views

web3py Filter Contract Events

I am new to web3py and I am trying to filter the events of a certain ERC20 contract. I can successfully call the contract's functions, but I struggle with the events. contract = w3.eth.contract(...
1
vote
1answer
25 views

how to calculate the correct amount with decimal

I have total token 99,999,999.99999457, It is 8 decimal, but when I do like below I get 99999999, I expected 99,999,999.99999457: const decimals = await this.contract.methods.decimals().call(); ...
0
votes
0answers
21 views

Web3 - Total Suppy

Just wondering if there is a way to calculate the total supply via web3? I imagine you'd need to scan for all addresses? Not sure where to start with coding this one.... EDIT: So since it's not ...
0
votes
1answer
38 views

Type Error: web3.eth.Contract is not a constructor but web3.version is 1.0.0

Why can't I instantiate my smart contract? When I try and instantiate an instance of a smart contract with the following code... let contractInstance = new web3.eth.Contract(abi, '...
0
votes
1answer
15 views

function overriding is quite working when called with web3.js

function getDetails(address publicKey) public view returns (Organization memory) { return s.getOrg(publicKey); } function getDetails(string calldata orgID) external view returns (Organization ...
0
votes
0answers
23 views

Web3 method getTransactionReceipt() does not return token transfer value for particular token transaction

I've tested getTransactionReceipt(), to get all detail about transaction with amount of token transfer. Also tested getTransaction but it returns only Ether transferred value. Is there any other ...