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
10 views

How do I unlock the Parity Ethereum Ethash prefunded account?

So i have my ethash node running with the following chainspec.json { "name": "Morden", "engine": { "Ethash": { "params": { "...
0
votes
0answers
6 views

In web3.php, how can I transfer erc20 token?

In web3.php, how can I transfer erc20 tokens? I try to figure out the way to do this in web3.php.
0
votes
1answer
15 views

Transaction response doesn't contain “receipt” value

i'm doing this send function let result = await myContract.methods.myMethod().send({from: account}); console.log("result:", result); using web3.js ^1.2.2 on testRPC with Ganache, hardfork Byzantium, ...
1
vote
1answer
16 views

Web3.js error: Uncaught ReferenceError: abi is not defined

(Working from the Lynda Ethereum course, a simple "approver" contact and UI) This line: var ApprovalContract = web3.eth.contract(abi).at(contractAddress); Is giving the following error: ...
-2
votes
0answers
5 views

How to enable a node with only the Whisper functions?

I need to enable nodes only to exchange WHISPER messages. Also, I intend to deploy it over IoT devices. So I'm looking for a realy minimal implementation of an Ethreum node. I believe it should still ...
0
votes
1answer
23 views

“VM Exception while processing transaction: invalid opcode” only with Byzantium hardfork

i'm testing my Smart Contract with Truffle and Ganache, everything works fine while using hadfork version "Petersburg", but when i switch to Byzantium i receive this error while truffle performs ...
0
votes
1answer
11 views

JS “TypeError” - Simple UI script is giving an Uncaught error

I am doing the Lynda Ethereum course and am working on the UI with JS. This line of code: var ApprovalContract = new Web3.eth.Contract(abi,contractAddress); Gives this error: index.html:114 ...
-1
votes
0answers
19 views

Web3.js error message in Chrome, “Uncaught ReferenceError, Web is not defined” [closed]

I get the following Chrome (console) error when loading a UI for my contract using Web3. Console should print the Web3.js version number. JS is pasted below. Thank you. index.html:76 Uncaught ...
0
votes
0answers
17 views

window.ethereum

When i made web3 instance and run index.html i lose ethereum and window.ethereum when i call it from console i got ethereum is not defined,i have installed metamask and use ropsten network.Why its ...
0
votes
1answer
19 views

Web3 js proper way to call a Reading contract function

So i recently took over a project that had been abandoned for a while, which involves an ECR20 smart contract and the use of the web3 library to communicate with the smart contract. I've been trying ...
0
votes
0answers
9 views

How can I call a method on a smart contract with the web3 provided by MetaMask?

How can I call a method on a smart contract with the web3 provided by MetaMask? Building smart contracts with solidity was the easy part for me. I had relatively few problems thanks to https://remix....
0
votes
0answers
12 views

Example of web3

Share example of code that connect to ethereum contract and interactive with him.I want use jsdeliver in html not work in node.js.Show me simple example of interactive. <script>src="https://...
1
vote
1answer
8 views

Uncaught TypeError: Cannot read property 'fromWei' of undefined, working good in one tab and failing in another tab

I'm getting this error when I'm trying to convert Wei to Ether using the code window.web3.utils.fromWei("200000",'ether'). This error shows only on the single page and when I console.log in the same ...
1
vote
1answer
13 views

How can I measure the gas used in a block of code?

This answer explains well how to measure the gas used in a block of code. I had actually been using this method before I found that answer: pragma solidity 0.4.26; import './IERC20Token.sol'; ...
0
votes
0answers
9 views

Metamask and Web3

I use this in html src="https://cdn.jsdelivr.net/npm/web3@1.2.6/dist/web3.min.js" and when i call some functions i get error.Why this happend?Example i cannot call ethereum.enable() for allow ...
1
vote
1answer
22 views

keccak256 output is different on ruby vs javascript…?

Ruby ethereum libraries use: https://github.com/phusion/digest-sha3-ruby require 'digest/sha3' '0x' + Digest::SHA3.new(256).hexdigest('0x0') => "...
1
vote
1answer
18 views

Metamask doesn't show token value on erc20 contract interaction

Why using the Transfer method is showing the value of the erc20 that I want to transfer while with a custom method is always showing 0 ETH on metamask instead of the token that I'm transferring via ...
0
votes
1answer
26 views

getTransaction sometimes returns null when transaction is pending

I am looking to get real time transaction data as it is broadcasted to the ethereum network, so I have subscribed to pendingTransactions. This only returns the transaction hash though, so I have to ...
0
votes
0answers
18 views

how i know what function run the trasaction?

i have that question , how i know what function runs the transaction ?, let me explain , if i do a transaction in remix.ethereum i can see the transaction in the bottom and in the details of this i ...
0
votes
1answer
24 views

Get emitted events of a a smart contract function using infura

I have used infura in my App.js to connect to the kovan network. Then I am creating an instance of the smart contract deployed on that network. Then I am calling a function on that smart contract ...
0
votes
2answers
8 views

Transaction won't be mined / Failed signing of transaction

I'm trying to send a transaction that writes somesthing on ethereum(kovan) but it seems my transaction is not mined and probably not even send to the network? All my view requests to ethereum work, so ...
0
votes
0answers
11 views

What's the Difference Between Accessing ChainId Through the Provider or the .net.getId() method?

It seems there are two documented mechanisms for obtaining the chainId to identify if web3 provider is on mainnet or one of the testnets. The first that I've seen is using web3.eth.getId(). However, ...
1
vote
2answers
20 views

Duplicate data in “returnValues” field of event emitted in solidity script

I am using quoram distribution through Azure blockchain service.. we are emitting few events according to our logic and these events are being used to get specific data from the transaction.. though ...
0
votes
0answers
8 views

How to intergrate Etherum Wallets for my business [closed]

What will it take intergrate Etherum Wallets for all my customers. I run a business and would love my customers to be able to create their own Etherum Wallets to receive and send.
1
vote
2answers
17 views

For multi sign transaction, who will pay gas? [closed]

For multi sign transaction, who will pay for the gas? Any sample code? I am not quite sure about this.
0
votes
0answers
7 views

How can I use account1 to sign but use account2 to send signed transaction? Who will pay the gas? [closed]

If I use account1 sign transaction but use account2 send signed transaction who will pay the gas? Account2? Any sample code?
0
votes
1answer
10 views

Truffle Test: Setting blockTime

I'm using Truffle and I want to increase the blocktime to mimic that of the mainnet when i run my tests. As i understand it, Truffle has already instantiated a web3 instance that's ready to use so i ...
0
votes
0answers
8 views

Whether I can use web3.js and ethers.js at the same time? [closed]

Why I can use ethers.js and web3.js together? Thanks. In same nodejs.
0
votes
1answer
27 views

Web3 1.2.6 appears to ignore require in view function

Given the following function: function checkLock() external view returns (bool) { require( address(this) == IERC721(_nftRegistryAddress).ownerOf(_tokenId), "[...
1
vote
1answer
17 views

How to find the source code of my contract which is not yet verified

I had created a token using eth based blockchain via remix.ethereum.org But I need to verify the source code ,but I am not having the backup copy of source code How can I see the source code of the ...
0
votes
1answer
31 views

Error: "Transaction ran out of gas. Please provide more gas:

I'm facing a little issue here, that's the mintTo function from contract for NFT. Which I require the sender to send a value with >= 0.1 Ether: pragma solidity ^0.5.0; import "./TradeableERC721Token....
0
votes
1answer
14 views

How can I set my custom gas Price and gas Limit?

I want to set my custom gas and gas Price in sendTransaction method.Currently I set it but when i send the transaction gas fee is showing 0.21 ETH in metamask. How can I solve this? web3.eth....
0
votes
1answer
31 views

I'm getting “Cross-Origin Request Blocked” error

I'm getting this error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8545/. (Reason: CORS request did not succeed). I'm aware ...
0
votes
0answers
14 views

web3.js function contract.once() not working on Kovan, but working on ganache

I am subscribing to an event (just once, queued after an update) of a contract to reload the data like this on my react frontend: const instance = new web3.eth.Contract(abi, address) instance.once( ...
0
votes
2answers
25 views

How to deploy multiple compiled solidity with web3?

So I have this codes const MultiSigWalletFactory = fs.readFileSync(path.resolve(__dirname, "MultiSigWalletFactory.sol"), "utf8"); const Factory = fs.readFileSync(path.resolve(__dirname, "Factory....
0
votes
0answers
25 views

How to get type of a contract internal transaction? [duplicate]

I'd like to get type(create, call, ...) of a contract internal transaction, like [this page of etherscan.][1] However, I couldn't find it any responses and documents of web3js. I'm getting a contract ...
0
votes
0answers
22 views

Web3 Call() function send parameter and code separately

I am using parity ethereum, When I use the call() function from web3 js, the data which I receive data = data + params which is embedded. Is it possible to send from web3 js data and param separately ...
1
vote
1answer
16 views

What is an index position of an uncle?

I see this document. But I don't understand what is an index position of an uncle. I'd like to get informations of uncle blocks like etherscan.io However I don't know a value of the index position ...
0
votes
1answer
27 views

Interact with smart contract without metamask

I'm writing an ethereum application that I want to use for an IoT demonstrator. I want to use MQTT to subscribe to an topic and as soon as a signal is transmitted to that topic I want to write ...
1
vote
0answers
13 views

How to deploy blockchain app in heroku

I want to deploy my blockchain app in heroku and i just want to use ganache as my blockchain network. is that possible?
0
votes
1answer
18 views

Read message of require statement in app.js

In my App.js I have called the smart contract function and the require statement in the function is not satisfied, so how do I get the message of that require statement in my App.js?
0
votes
0answers
20 views

Is it possible to use ganache blockchain when I deploy my web app in heroku? or should I deploy the contract first to a test network?

const web3 = new Web3( new Web3.providers.HttpProvider( "https://kovan.infura.io/v3/INFURA_KEY" ) ); const abi = JSON.parse( '[ { "constant": false, "inputs": [ { "internalType": "string", "...
0
votes
1answer
20 views

Executing an contract via code and without metamask / link an account to JS code to automatically wirte on Ethereum

I'm trying to get my JS-code to call a smart contract on Ethereum (kovan testnet) that will write something on the blockchain and therefore needs ether (actually gas). I called a view function which ...
1
vote
1answer
25 views

Get each transactions from response of txpool.getContent()

I'm trying to get each transactions from response of txpool.getContent(). The response structure is here. > pending: { '0x0000000186c96Ab17A967d7A3033db82efcA587B': { '11': [Object] }, '...
1
vote
0answers
14 views

How to use Web3Js to sign a message in a react native mobile app [closed]

I am very new to Ethereum. I have requirement to sign the app using Web3JS in my React native mobile App. I used this link to get web3js working properly. But I am not sure how to connect to wallet ...
1
vote
1answer
27 views

Error: you must provide the json interface of the contract when instantiating a contract object

That's the error that occurs when I try to test my contract. Can someone tell me what the problem is? That's the code for the test: const assert = require('assert'); const fs = require('fs'); const ...
3
votes
1answer
17 views

Do we need to sign transaction for totalSupply also? [closed]

I am using web3 and want to sign transactions made with ERC20 contract.
2
votes
2answers
30 views

Meanings of a txpool.getContent() response

I'd like to understand the structure of response for txpool.getContent(). I got a following response from my geth node. > pending: { '0x0000000186c96Ab17A967d7A3033db82efcA587B': { '11': [...
1
vote
1answer
38 views

When testing a contract, NodeJS returns: “SyntaxError: Unexpected token u in JSON at position 0”

My NodeJS script gives me this error: 1)"before each" hook for "deploy a factory and a lottery" SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse((anonymous)) at Context.(anonymous) ...
1
vote
0answers
29 views

transferFrom is not displaying DAI amount on MetaMask verification popup

I am using web3.min_1.36.js to send DAI to a contract. I already called "approve", so transferFrom is working correctly without error. However, the Metamask verification popup does not display the ...

1
2 3 4 5
75