Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
1answer
39 views

Unhandled promise rejection (rejection id: 1): Error: Transaction has been reverted by the EVM:

I don't know where i'm doing mistake. I have deployed my contract through remix and truffle and it was deployed without any mistake but now i'm deploying it from web3 solc@0.4.24 version and EVM is ...
0
votes
1answer
154 views

What is the best way to interact with ERC20 contract via web3js?

I've trying to set up a dev environment for an ERC20 token. I configured my backend (NodeJS) and created a basic ERC20 token using Truffle and OpenZeppelin. Everything is fine, I was able to persist ...
44
votes
8answers
21k views

How to get contract internal transactions

I'd like to get the contract internal transactions like: https://etherscan.io/address/0xd654bdd32fc99471455e86c2e7f7d7b6437e9179#internaltx I'm using web3 API. Is there any way to do it? Where do ...
0
votes
1answer
171 views

Private Ethereum Chain and Web3 js API

I've developed my own private chain for testnet using geth and CLique and i have some issues with web3.js environment. I starts my nodes using the console parameter in order to get to the Web3 console ...
0
votes
0answers
10 views

web3js batch execute method gives error

I have private/local network/chain setup. I'm building this with Nodejs-->expressjs. const contract = new web3.eth.Contract(abi, address); const batch = new web3.BatchRequest(); batch.add(contract....
1
vote
3answers
90 views

Reading the result of a function that change state by using events in Solidity

I would like to get the result of a function by listening its emitted event. These are two pieces of code of my contrats CONTRACT 1: function createTradeableContract() public stopInEmergency ...
0
votes
0answers
15 views

How to import account of metamask in js?

ethWeb3.eth.getAccounts((error, accounts) => { console.log(accounts[0]); $('#currentAcntDisplayID').text(accounts[0]); ethWeb3.eth.defaultAccount = ...
0
votes
0answers
26 views

Why this error occurring when i running my dapp?

I create a dapp using Solidity,Web3Js,Javascript and Html with metamask i always getting this error when i am trying to submit my transition i am getting this error at c (inpage.js:1) at ...
0
votes
2answers
539 views

how to install web3 (1.0.0)?

I have 0.20.0 installing but not the default 1.0.0. I have Ubuntu 18.04 installed. Is any special config needed for Ubuntu 18.04 when installing web3 (1.0.0)? trevor@bridge2:~$ sudo npm install ...
1
vote
1answer
106 views

How to simulate multiple consecutive transactions and get the resulting state?

I'm trying to simulate a transaction on the public blockchain that invokes a contract's method with certain parameters. Then I want to make a follow-up transaction with some other method call. I ...
0
votes
1answer
105 views

unable to write transactions on rinkeby from javascript file

I have written a contract which read and write data into blockchain using truffle. when i deployed that contract on rinkeby and called functions using web3.js the read functions works fine. but write ...
0
votes
1answer
152 views

The contract code couldn't be stored, please check your gas amount while deploying contract

I'm trying to deploy 3 contract in 2_deploy_contract (I deploy all 3) but after the first is deployed I get the following error : The contract code couldn't be stored, please check your gas amount.
1
vote
2answers
2k views

Create an Ethereum wallet with React Native for single token

Many of you might think that this question has already been answered but I don't think that there is a clear answer on the internet for the current Ethereum, Web3.js and React Native versions (for ...
0
votes
1answer
48 views

How to connect Trust Wallet in Javascript?

I want to use TrustWallet for payments in my project for mobile users. I saw the documents related to TrustWallet web3 API but not getting how to use it in javascript. Can anybody help me with the ...
0
votes
1answer
387 views

Creating a transaction from a webform - invalid number of args

I have a HTML web page where I am feeding user entries into a smart contract that is designed to "store" the entries in transactions. I have most of the application working, but I'm having trouble ...
0
votes
1answer
10 views

Cannot declare web3 object in JavaScript

When I try to declare a web3 object It's always undefined. I'm writting in JavaScript and using Infura as my provider for the ETH mainnet. I also tried with a local blockchain instead of Infura, but ...
0
votes
1answer
19 views

Sending a transaction without using MetaMask

I have designed a contract deployed on the Rinkeby with web3. I have also implemented a react app to interact with the blockchain. I want to use my application without metamask but I got this error ...
0
votes
1answer
16 views

How to call setter method of smart contract with web3 1.0.0

I don't know why but i'm not able to perform transaction with this code. please help me out i'm stuck. i just have to call setter method of my contract with some arguments. router.post("/set", async ...
0
votes
0answers
14 views

Web3js v0.20.7 - callback ls not a function

I'm facing issue of callback is not a function in web3js 0.20.7 when i call the method of sendRawTransaction to deploy smart contract with web3. When i used the same method just to call deployed ...
0
votes
1answer
33 views

Solidity Error:Running Out of Gas / selfdestruct problem

I've been going through 'Building Cryptocurrency and its ICO' by DappUniversity. I know many have questioned this issue and I've been through all the post but couldn't resolve it. The problem is self-...
0
votes
2answers
118 views

Batch processing of contracts

Is there a way of defining contract data to be deployed and then running in a batch to deploy to the Blockchain? I am developing an application and would like to have the ability to load up test data ...
1
vote
1answer
110 views

Merkle proof for Smart Contract mapping field data

I'm trying to get merkle proof for Ethereum Smart Contract mapping field data. I created test smart contract and deployed to test network. Smart Contract Code like following code: contract ...
0
votes
1answer
78 views

Transaction stuck in 'Pending' state when using 'sendSignedTransaction'

I am trying to execute a transaction by first signing it with my private key using ethereumjs-tx and then using sendSignedTransaction to send the transaction to the network. But somehow the ...
1
vote
1answer
49 views

Can the Android Metamask Extension be used with DApps?

I've successfully downloaded the Metamask Firefox Add-on, and imported my wallet into it. However I'm failing to see how I can use this add-on from within my DApp like I do on Chrome, using the ...
0
votes
1answer
147 views

adding the contract value but still not changed

I am using web3 1.0 and testrpc, The following is my contract. pragma solidity ^0.4.18; contract LocalEthereum { event Created(bytes32 _tradeHash); uint32 value = 0; function addValue() ...
0
votes
1answer
165 views

Ganache not working

I am developing on a testnet on ganache and using remix. I am working with web3 and working on the user interface. when trying to fetch a function with web3/ganache, I get the following error: "...
1
vote
2answers
2k views

Unable to npm install web3 on Windows 10

I followed every thing on this page : https://medium.com/@PrateeshNanada/steps-to-install-testrpc-in-windows-10-96989a6cd594 Except step number 5 where my Node.js version is 8.10.0 instead of 8.10.2 ...
0
votes
2answers
36 views

Why web3.version.api shows undefined for web3 1.0 and not undefined for web3 0.20.3?

I'm trying to use MetaMask and web3js to talk to my smart contract. Below are my test codes. This is without defining a web3 js file and I get the result "0.20.3" at console. <script> window....
0
votes
1answer
70 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"} ...
1
vote
1answer
28 views

How to find the Bytecode of Ethereum Smart Contract by just it's address using JSON RPC

I am wondering that is there any way to find the byte-code of the Smart Contract which is published on a blockchain just by having only idea about it's contract address using JSON RPC running at 8545 ...
1
vote
1answer
241 views

Timeout exceeded during the transaction confirmation process

I am trying to figure out the right syntax for solc 0.5.7 and web3 1 beta 52 Follow my source code: contract.sol pragma solidity ^0.5; contract Hello { string public message; constructor (...
0
votes
1answer
365 views

Sending ether to a contract

Beginner in solidity and i'm trying to send ether from an address to a contract. I've tried transferring ether using the Remix compiler test accounts. pragma solidity 0.4.25; contract sendether{ ...
0
votes
2answers
52 views

Solidity event isn't fired

I'm trying to listen for an event I've created on remix IDE , from NodeJS. I call a smart contract method from where the event is triggered and I'm waiting for it in my console...but I don't receive ...
2
votes
1answer
127 views

Solidity cross programming language method calling

I was wondering if it is possible for solidity to call functions of other languages. More specifically, I am planning on developing a basic distributed search engine using the ethereum blockchain and ...
2
votes
2answers
2k views

Integrate web3.js into a native iOS & Android Apps

Integrating web3.js into a native iOS & Android Apps has issues. I am having difficulty integrating web3.js into a native mobile App (iOS & Android), would it be reasonable to use a cloud ...
0
votes
1answer
18 views

In node.js event is not fired

I am using web socket to get event. sending transaction works fine. but event is not fired. also I referred Web3 events not working but it does not work, too. I used eventemitter also. but it did ...
0
votes
4answers
2k views

web3 1.0.0 method call doesn't work

I've successfully deployed on Ganache test network a contract with this test method in it: function test() public pure returns (uint) { return 7; } In my JS script I try to call this method in ...
0
votes
1answer
94 views

Web3js can not touch smart contract, always return 0

web3js can not touch smart contract. var id = dragoncore.getGenesNum(); has no error, but always return back 0, never changed. -----------------------------web3js code ----------------------------- ...
0
votes
2answers
381 views

How to destroy a token or list of token from a another contract?

[Edit 14-03-2018] I want to create a contract A that can generate a random number of Token A and another contract B that receive and destroy one or many of this token to generate a new Token B. It's ...
1
vote
1answer
122 views

Ropsten rejects my sendSignedTransaction function

This is my code: contractNoEvents.methods.myMethod().call(function(err,foo){ if (foo.length > n) { contractNoEvents.methods.myOtherMethod().call(async function(er, bar)...
10
votes
1answer
751 views

How can I reliably induce a blockchain fork for testing purposes?

I would like to reliably induce a fork on a private testnet so that I can test the behavior of off-blockchain code that interacts with contracts. (see related questions as to why I would want to do ...
1
vote
1answer
117 views

are truffle tests inconsistent?

Im currently testing my contract and I've written truffle tests in js for the first time. Rarely (1 out of 10 times?) I get unexpected results: This is the code structure I use: var contract = ...
1
vote
1answer
28 views

Smart Contract is being deployed but call does not return contract address after deployment

So I have been trying to deploy a smart contract using nodejs, but when I call the function to deploy, I get no contract address on my console. It's like the send() function never completed its ...
1
vote
1answer
27 views

web3 - Contract deployment has been reverted by the EVM

I want to deploy a contract but my transaction gets reverted. This only happens with Web3, while it works fine with Remix.I can assure the ABI and Bytecode are correct because I pasted them from Remix,...
2
votes
1answer
196 views

subscription not happen on geth+websocketProvider in web3

I have started geth node (connect to ropsten testnet) on my local OSX system. Command: geth --testnet --fast --bootnodes "enode://...
1
vote
2answers
47 views

Can't deploy contract with web3.js and ganache-cli

I'm using the solc module to compile a Solidity contract. The compilation step looks to be working correctly, however, when I attempt to deploy the contract to the Ganache network (in a Mocha test), ...
0
votes
1answer
108 views

ReferenceError: address is not defined

Truffle v5.0.5 (core: 5.0.5) Solidity v0.5.0 (solc-js) Node v10.15.1 ReferenceError: address is not defined. const ApprovalContracts = artifacts.require('../../contracts/ApprovalContracts.sol'); /...
2
votes
1answer
141 views

Connecting to blockchain on azure using web3.js and websocket

right now, I am trying to write a service using web3 which will 'subscribe' to all 'perndingtransactions' on blockchain to perform further actions. web3 documentation says that 'Httpprovider' cant be ...
1
vote
1answer
120 views

geth - web3 : checkBalance not supported

Here is what I did : Terminal 1 : geth --syncmode "light" Terminal 2 : geth attach > web3.fromWei(eth.getBalance(eth.coinbase), "ether") Error: not supported at web3.js:3104:20 at web3....
1
vote
1answer
18 views

Developer downloading ledger reasoning? [duplicate]

My question is a little odd, but I will ask it anyways. From a development perspective, knowing that there is a service such as Infura, why would a developer download the whole ledger? Infura ...