Stack Exchange Network

Stack Exchange network consists of 174 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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Javascript API and library for Ethereum

1
vote
0answers
11 views

Unable To Get Strings Returned In Web3.js (JSON-RPC error)

I have two getter functions in Solidity to return different attributes, but when calling them from a javascript file, the one that returns a string type attribute results in an error (while the one ...
0
votes
0answers
15 views

solidity - event raised only in Remix IDE; not in private network

This is the function in my Solidity contract. // To be fired when inputs are not valid event Status ( string msg ); // Create a new org of lenders with assigned leader. // This function can be ...
0
votes
1answer
15 views

Error: Invalid JSON RPC response: “” infura on contract deploy

I am trying to deploy contract i am using web3.js version web3@0.20.4 with infura node following code i am trying const fs = require('fs'); const solc = require('solc'); const Web3 = require('web3'...
1
vote
2answers
18 views

solidity - Invalid address error when invoking a function with array as an argument

My Solidity contract has a function like so function newOrg(bytes32 orgId, bytes32[] members, bytes32 head) public payable. In my javascript file, I have this: var Web3 = require('web3'); var fs = ...
0
votes
0answers
12 views

Is there a way to force truffle (web3.js v0.20) to execute a failing transaction

In truffle/web3, when a transaction will fail, it refuses to send the transaction to the network. Is there a way to force it to send the transaction (and use the gas) even if you know it will fail. [...
0
votes
0answers
8 views

Parity node runs out of available RPC connections using web3

I'm using nodejs with web3 1.0.0. There are 2 instances of my app running, each making a websocket connection. For some reason, my parity node seems to quickly run out of available RPC connections (...
0
votes
1answer
19 views

Is it safe to have a locally running Ethereum node exposing personal RPC API?

I am developing a REST API currently running off a node.js server. The API allows ethereum account creation, making a transaction etc. The API interacts with a locally running ethereum node to ...
1
vote
0answers
16 views

web3js get all properties of contract in one promise

I'm implementing an app with a Factory design pattern. My Factory is creating instances of myContract, that I load thanks to myContract.at(address) like below: this.myContract = TruffleContract(...
1
vote
0answers
32 views

Detecting ETH and Token deposits on an address and/or multiple contract addresses

Many questions have been asked here but mostly they have been vague questions and/or answers so before marking as duplicate please read this one as its completely specific. I have an ether account ...
1
vote
0answers
14 views

Getting error invalid command: “networkid=15”

geth --rpcapi eth,web3,personal --rpc networkid=15 2>&1 | tee -a blockchain.log while running the above command i get following error invalid command: "networkid=15" And the same ...
1
vote
2answers
33 views

MetaMask Web3 object does not support synchronous methods without a callback parameter

I'm new around here and would appreciate some intuitive help. I wrote a contract and made a UI for it, and it's all working fine with ganache-cli. However, now that I've launched it on Ropsten and on ...
1
vote
0answers
15 views

GETH node works on Apache but not on ExpressJs

I had a running GETH node linked to my localhost (hosted with Apache) , I had to migrate the project on a ExpressJs running on port 3000 and now I have Error: CONNECTION ERROR: Couldn't connect to ...
1
vote
1answer
19 views

Argument encoding: list of uints (uint[48])

Using python web3 module, attempting to call a contract function that takes one argument, a list of 48 uints: function checkOrderBatch(uint[48] input) external view returns(uint16[16] status, uint[...
1
vote
1answer
13 views

Getting 'base fee exceeds gas limit' on a transaction which requires a small amount of gas

I have the following contract: pragma solidity ^0.4.24; contract MyContract { address public owner; bool public unlocked; constructor() public { owner = msg.sender; ...
1
vote
0answers
23 views

What's the point in the 'gas' parameter passed to function 'signTransaction'? [duplicate]

I am using web3.js v1 in order to sign and send transactions: async function signAndSend(transaction) { let options = { to : transaction._parent._address, data: transaction....
1
vote
1answer
21 views

Not able to send Ether to contract

I am trying to send Ethers to a contract deployed on Ganache but I am getting VM Exception while processing transaction: revert, the same logic is able to transfer Ethers to other account. Following ...
1
vote
1answer
36 views

How to change a state variable in a smart contract with web3.js

I am new to solidity and web3.js. I have a very simple solidity code deployed on the rinkeby like pragma solidity ^0.4.24; contract sample { string public name; function set(string _name) ...
1
vote
1answer
28 views

How to get notify if transaction got failed, dropped, or successes

I am new in dapps world and I want to deduct balance/points when a user buys an item currently I am unable to update balance because sometimes transaction got failed, dropped, or successes after 30 ...
0
votes
1answer
27 views

errored: base fee exceeds gas limit

the default value for uint variable is 10 now on function call, I want to change this value to 0 steps to reproduce: copy the following code to remix: pragma solidity ^0.4.19; contract test { ...
0
votes
2answers
15 views

How to download or access ('web3/lib/web3/event.js');

The following test script requires('web3/lib/web3/event.js'); const SolidityEvent = require('web3/lib/web3/event.js'); function decodeLogs (logs, contract, address) { return logs.map(log => { ...
0
votes
1answer
17 views

“Error: sender account not recognized” when calling transferFrom() on an ERC721 contract

I am having an issue transferring ownership of an ERC721 token to a deployed Holding contract. The error I’m getting when running truffle test is the following - Error: sender account not recognized ...
1
vote
0answers
28 views

Watch Events with same Name but different params

using web3@0.0.xx is there a way to get Events overloaded (with the same name, but different params) ? I found contract.Transfer[‘address,address,uint256,address,bytes’]({ fromBlock: 0, ...
0
votes
0answers
17 views

Getting an error on calling a function from web3 which returns only bool values

I am using Truffle React box and for the smart contract I have made use of the Factory design pattern. Contract Factory.sol creates instances of Campaigns. The instance created will have its details ...
0
votes
1answer
14 views

Solidity + web3 js Why amount stay 0 with this simple deposit function

I publsh and initialize this sm pragma solidity ^0.4.17; contract CommunityChest { function withdraw() public { msg.sender.transfer(address(this).balance); } function deposit(...
0
votes
1answer
12 views

Store ABI Value in var

I've finally managed to get my web3.js to work.. I did this only for the purpose to display one specific value on my website.. I'm not so good with jquery and hope you guys can help me out. This is ...
0
votes
0answers
30 views

TypeError: “this is undefined” in truffle while invoking a contract [on hold]

ProofOfOwnership.sol contract ProofOfOwnership { address public owner; mapping( string => Document) documents; struct Document { string docHash; string docTimestamp; ...
0
votes
0answers
22 views

Web3JS Batch transactions

So I have a script that distributes erc20 to multiple wallet addresses, but it creates a individual transaction for each address. Is it possible to group this transactions and save on gas cost? I ...
0
votes
0answers
26 views

RangeError: private key length is invalid (In New ETH Transaction)

Followed this Ans Ans1 and Ans2 but no solution got. const web3 = new Web3('https://ropsten.infura.io/v3/3c52917848e945229c0d33d632b10490'); const account1 = '...
0
votes
1answer
35 views

Integrating web3 from Metamask in React [on hold]

Having trouble integrating web3 from Metamask in React. Metamask version: web3@1.0.0-beta.34 import Web3 from 'web3' let web3; window.addEventListener('load', function () { if (typeof window....
0
votes
0answers
21 views

Cannot get return value of ContractData call outside of return method

I have been trying to use Truffle's Drizzle Box to render data from my Solidity Application. While I am able to access return values from my application in the render function of Home.js, I cannot ...
0
votes
2answers
20 views

Detecting oraclize completion for front-end update using Web3.js

I am using oraclize-api to fetch and store twitter posts into a smart contract. Posts are placed into a mapping using the twitter id as the key (i.e. <username>/status/<id>), and the tweet ...
0
votes
0answers
18 views

`getPastEvents` sometimes return “Invalid JSON RPC response”

I'm using infura (ropsten and mainnet) and this is a snippet of my code: MyContract.getPastEvents('SomeEvent', {fromBlock: fromBlock, toBlock: 'latest'}) .then(pastEvents => { console.log(`...
0
votes
1answer
33 views

Allow access to private ethereum network from certain IP only

I have a question regarding restriction access to private etehreum network. I created my Private Etehreum network using Geth(for now just only with one node) on the Ubuntu 16.04 virtual machine. And ...
0
votes
1answer
18 views

How to add available accounts at infura HttpProvider

I launch web3 at nodejs server,not in explorer(no MetaMask). const END_POINT = 'http://localhost:8545'; web3 = new Web3(new Web3.providers.HttpProvider(END_POINT)); web3.eth.getAccounts() .then((...
0
votes
1answer
14 views

How to set a timer in web3 event watcher? [closed]

I have a web3 event watcher set up in a Javascript file as such: var a; contract.events.allEvents(function(error, event){ if (event.event == "Set") { a = event.returnValues['val']; } });...
2
votes
0answers
20 views

Different outputs on event log subscription

These are the two ways I found to track events on the Ethereum blockchain. One of them doesn't contain the data I need. Why not? Way 1 does NOT contain the data I need Result: subscription = web3wss....
1
vote
1answer
23 views

The best Web3 providers online

Does anyone know what are the most popular web3 providers online? (Or is Infura the only one?)
0
votes
1answer
18 views

How to use web3 function (ecRecover) that shouldn't require a provider?

I want to use web3's ecRecover functionality and nothing else. Unless I misunderstand its requirements - a signature, the signed data, some cryptomagic and poof you have recovered the signer - why do ...
0
votes
0answers
27 views

How do DApps that don't need their users to run Ethereum nodes or Metamask work?

For example, A website which will give the option to register an ethereum account. The user would hit the register button and the server, which I assume is running a node 24/7 and will generate an ...
0
votes
1answer
17 views

Infura not broadcasting my transactions

I am using Infura with the mainnet and web3py to interact with smart contracts and send transactions. Last week this same code worked fine, but today, trying to send the transaction for the deployment ...
0
votes
1answer
28 views

Estimated cost through web3.js

I have written a web3 implementation. The code below invokes a method of solidity contract that writes some value to blockchain: var Coursetro = CoursetroContract.at('...
0
votes
1answer
21 views

Retrieving Data from a Mapping

I am having trouble accessing data from a mapping that I have created on the client side. My smart contract has 2 function 1 that sets the values for the mapping. The second one retrieves the ...
0
votes
0answers
27 views

Dapp new user accounts in ethereum

I create dapp with the ability to register users. I have no ideas on how to do so that the registering user could create a new account in the ethereum network. If I connect to the main network using ...
0
votes
0answers
16 views

Get estimated gas and provide gas limit in web3.js [duplicate]

I have written a web3.js implementation in Node.js(server-side). The code below invokes a method of solidity contract that writes some value to blockchain: var Coursetro = CoursetroContract.at('...
0
votes
1answer
18 views

true and false not the same as 1 and 0 for web3 / solidity?

When I use remix to execute a function with a bool field and I put 0 into it (which I interpret as false), the remix console output tells me "bool myBool": true (what I don't understand). So I would ...
1
vote
1answer
90 views

Transaction has been reverted by the EVM:

I have created a contract and contract is successfully deployed. I can see it on 'https://rinkeby.etherscan.io/' While accessing its ABI using web3 and paying money using meta mask Smart contract ...
0
votes
0answers
13 views

“Invalid JSON RPC response” using web3.getPastEvent

I am using web3js to query a remote geth node (Geth/v1.8.14-unstable-35fcd2f4/linux-amd64/go1.10.3) for a particular event Ping emitted by a smart contract. myinstance = new web3.eth.Contract(myABI, ...
0
votes
1answer
24 views

Is there any way to run web3 as cli?

On many occasions, I'd like to quickly connect to a local or remote node via web3.js and query for things directly from the console. I imagine something like: web3-cli set --host http://localhost:...
0
votes
0answers
37 views

web3 remix cannot deploy contract

I have a problem when deploying smart contracts on remix. When I click create, I can see that transactions are passing through, from the blockchain explorer. I clicked multiple times, and this is the ...
1
vote
0answers
10 views

Cannot connect to the Web3 provider when rpccorsdomain is on

I am getting the message: Not possible to connect to the Web3 provider. Make sure the provider is running and a connection is open (via IPC or RPC). When I specify: --rpccorsdomain "http://...