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

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
0answers
26 views

web3 smart contract calls to slow (arrays / lists)

I call contract like this : static async getInitialProps(res) { const users = await UsersContract.methods.getUsers().call(); const totalusers = await UsersContract.methods.getTotalUsers()....
0
votes
1answer
20 views

Unable to transfer from a contract to another contract

I was trying to learn how smart contract interaction by implementing a bank contract and a client contract. The end user create a Client contract. Then, he use the Client contract to deposit or ...
0
votes
1answer
16 views

Migrates contract with specific account without hard-code address using truffle and Genache

Block Builders! I am trying to migrate my two smart contracts using truffle and Genache. I would like to specify the deploying accounts existing locally. However, when I try to migrate the contracts I ...
1
vote
1answer
27 views

Call solidity function synchronously in express

I am retrieving data from mysql and looping through each row. up till here everything executes in the order I want it to. However in the same loop I need to call a smart contract function in order to ...
0
votes
0answers
38 views

Error: [ethjs-abi] invalid hex or buffer, must be a prefixed alphanumeric even length hex string

While recovering address from hash and sign, getting above error. myHash = '0xd0109ef5f602b69354acd389a2c752f9b80ef6bbce92a922ae8853d43a027b68'; mySign = '...
3
votes
2answers
32 views

ERC-20 Token Transfer Error : Bad jump destination

I'am trying to send ERC20 from 1 address to another but i'am getting that error : Blockquote Contract 0x557e4cca38277b9bf9f1f1bf333dfe4b0ac5541a Warning! Error encountered during contract ...
0
votes
3answers
37 views

Contract methods calls return empty array

I'm quite stuck with this issue. It seems like it must work, but it doesn't :D Have a contract on rinkeby network which is working perfectly through remix(load by address) and truffle console. ...
0
votes
1answer
15 views

Output order changes after the event triggered

I'm new to solidity so for educational purpose I'm developing EVoting application. I've written a smart contract for candidate registration and also developed UI for getting the registered candidate ...
1
vote
0answers
26 views

web3js 1.0 fromWei throwing although passing correct type

I have encountered a problem with the web3js 1.0 library. I have a simple function that is getting a balance from a smart contract: async balance() { return await this.Marketplace.balances(this....
0
votes
0answers
26 views

Unable to Call the balanceOf() function from web3 using the input wallet address

This is my web3js and html code for frontend <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=...
1
vote
0answers
23 views

How can I make an offline transaction and send it to Ethereum client network in java?

private class Myclass extends AsyncTask<Void, Void, Void> { protected Void doInBackground(Void... params) { //sldknfbhvsjhxcnzmcxcmj Web3j web3 = Web3jFactory....
0
votes
1answer
28 views

How are truffle artifacts different from ABI?

How are truffle artifacts different from ABI? Do Truffle artifacts include fields that are different from ABI that is generated using remix?
0
votes
1answer
64 views

web3 Uncaught TypeError: Cannot read property 'createBox' of undefined

i'm trying to create simple application by using solidity 5.0.0 , Truffle v5.0.0 and web3 web3@1.0.0-beta.34. but i've gotten Uncaught TypeError: Cannot read property 'createBox' of undefined. these ...
0
votes
1answer
27 views

Have a connection problem with smart Contract using web3.js

Anyone that can help me in how to interact with our smartcontract using web3.js. I tried below code but this not work: This the code that I am using: if (typeof web3 !== 'undefined') { web3 = ...
1
vote
1answer
25 views

Why do we have to mention Solidity version?

While writing code in solidity, why do we have to mention the compiler version?
0
votes
1answer
21 views

What's the default web3 gas price? [duplicate]

When sending a TX, there's an optional gasPrice field. If I don't set it, what's it default to? Does it look at other TXs going on or is it a fixed value that only changes when web3 gets updated to a ...
1
vote
1answer
36 views

Infura not broadcasting contract deployment transaction

I am attempting to deploy a contract via an Infura node, and I am the point where a txhash is generated from the sendSignedTransaction() web3 function. However, after the txhash is generated nothing ...
1
vote
1answer
29 views

TypeError: 'deploy' is not a function

When running the following code within geth console, I am recieving the following error: TypeError: 'deploy' is not a function var storageContractAbi = storageOutput.contracts['contracts/29.sol:...
1
vote
1answer
28 views

Any who has done any smart contract analysis? [closed]

I want to analyze smart contract application and I wanted to know if there is a crawler for it and after the contracts have been crawled using the data's from the contracts to analyze each block.
1
vote
1answer
15 views

Signed Message Verification failing for signed messages with multiple passes

I'm using web3 to verify signed messages using the code below: web3.eth.accounts.recover(message, signature); I'm testing against the list of publicly verified signatures on EtherScan - https://...
0
votes
0answers
25 views

Recommended Architecture for Deployment of Web3 APIS

I am making a dapp and need a suggestion for below: I have build smart contracts and deployed on Ropsen. I have written web3 Methods to interact with smart contracts with the help of Infura. I have ...
0
votes
0answers
24 views

Getting an error cannot read property “encodeParameters” of undefined

I am running a node.js server but while running it, i am getting following error. what could be the possible reason?
1
vote
1answer
66 views

Call a payable contract's function from another contract via an interface

I have two contracts, they are connected via an interface. When user calls contract1 function, it uses an interface to call contract2 function which updates it's storage. My problem is that I can ...
1
vote
1answer
77 views

Out of gas error for a view function

having a problem with calling a method of my deployed contract in the main Ethereum network. I have a 'view' function which returns user's refund balance, everything worked fine in my local ...
2
votes
1answer
25 views

How to set the call back in WEB3 with Jquery

I have 2 functions in blockchain contract to get the investors and funds for an address and tried to save that in excel. 1st Function To get the list of investors getInvestorsList() 2nd Function ...
1
vote
0answers
24 views

aes-128-ctr is not available

While trying to extract key from keystore file using password, using the library keythereum, I'm getting the error: aes-128-ctr is not available I'm using web3 version ^0.19.1. Ref: https://github....
0
votes
1answer
26 views

differents between web3.eth.signTransaction And web3.eth.accounts.signTransaction

I don't understand the differents between these methods web3.eth.signTransaction and web3.eth.accounts.signTransaction And when I have to use. If I try to use web3.eth.signTransaction with ganache ...
0
votes
0answers
20 views

Address array is not returning any of the address

I have create the variables to store the list of address and the funds by every investor. In etherscan.io, When I tried to check the investor list I could not see anything. Could you please let me ...
0
votes
1answer
20 views

Does the web3 Contract API support single mining after multiple “send” calls?

This is not about Solidity. My question is about web3.eth.Contract.send version > 3. I tried out web3.eth.Contract.call on a single contract and as I expected I can issue multiple calls in the EVM. ...
0
votes
1answer
41 views

Truffle and Ganache-cli test case fails

So I have this setup : truffle and ganache-cli I'm sending some ether to my contract, here is the related part of my contract: mapping(address => uint256) public balanceOf; function () ...
1
vote
0answers
36 views

Truffle test of two transactions during the same block

I'm trying to test a solidity function that only allows it to be called once per block. E.g. (my desired functionality): Tx1 calls Fn during block #100, and when successful sets a boolean flag for ...
0
votes
0answers
31 views

Out of gas using web3 but tests work

I'm doing an online course blockchain developer course and my last assignment is to create a smart contract to register stars. I’m getting an ‘out of gas’ error when I try and create a star using ...
0
votes
0answers
19 views

HTML file created in truffle setup is not getting launched in chrome

I have used truffle to compile the contract and create the ABI files. Now I need to point the ABI files in the HTML file. I have used the HTML code as mentioned below Question When I executed in ...
0
votes
1answer
22 views

i have erorr when sendTransaction web3

file javascript //smartcontract window.onload = function() { if (typeof web3 === 'undefined') { document.getElementById('metamask').innerHTML = 'Instal metamask dulu' ...
1
vote
1answer
18 views

web3.eth.sign sometimes gives V parameter of 54 or 55, ecrecover then fails. What's going on?

I've been using ecrecover and web3.eth.sign to authorize transactions, but when I run web3.eth.sign a second time on my server, the V part of the signature is wrong(or, at least, ecrecover thinks it's ...
-1
votes
0answers
34 views

How to send API request in HTTPS to smart contract using nodeJS?

Please help me with nodeJS API request. I setup HTTPS server in app.js but still api sends the request in HTTP. How can I send a request to smart contract in HTTPS? Code: userCreationApiRoutes.post('...
-1
votes
0answers
31 views

How to send internal transaction in ETH(Web3 or Curl Method)?

How to send internal transaction in ETH(Web3 or Curl Method) I've tried with below one var tx = {from: "0x391694e7e0b0cce554cb130d723a9d27458f9298", to: "0xafa3f8684e54059998bc3a7b0d2b0da075154d66", ...
0
votes
3answers
22 views

Transfer ETH using third party

I want to transfer ETH from an individual address to another address. So is there any API provider who can send ETH from single Address to another address. Also If I setup Web3 in windows machine ...
2
votes
0answers
22 views

Can I send transaction to a view|pure function?

This is the contract: uint public result; address public owner; constructor() public { owner = msg.sender; } function add(uint a, uint b) public returns(uint) { result = a + b; return ...
0
votes
1answer
46 views

web3.eth.getBalance(…).then is not a function

var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/5db0a2fb8a8948fdbe57bb19eecb5674')); web3.eth.getBalance('...
-1
votes
0answers
22 views

Get the exact modifier error string from ether.js/Web3 client

I have a geth private ethereum network set up. I have some contracts deployed. The contracts have numerous modifiers. I have both ether.js and web3 client to connect to the contracts and to make ...
1
vote
0answers
13 views

Web3JS throws InvalidResponse without Ganache core ever receiving a request?

Versions: Ubuntu 18.04 LTS Node.JS: 8.3.0 WebJS: web3: ^1.0.0-beta.37 web3-utils: ^1.0.0-beta.36 npm: 5.6.0 Truffle version 5.x (latest) I have traced through the HttpProvider code in the Web3 ...
0
votes
1answer
30 views

what is the equivalent of encodeFunctionSignature for web3.js version ^0.20.6

I want to check if a specific contract deployed at an address is an erc721 contract. I found out that most of the erc721 contracts should have safeTransferFrom function implemented. (except ...
1
vote
1answer
20 views

truffle web3 synchronous request problem

Error: Web3ProviderEngine does not support synchronous requests. That's what I get when I use the following command from Truffle Console: truffle(ropsten)> web3.eth.getBlock('latest').then(...
1
vote
1answer
85 views

Recently upgraded Solc and Web3. Transactions with zero addresses now reverting with “invalid address” message?

I recently upgraded Web3JS and Solc. Now every time I pass a zero address to a Solidity contact method the transaction reverts with an "invalid address" message. This message appears to be coming ...
1
vote
0answers
27 views

Metamask and web3 wrong behaviour when extension is disabled

Basically I have a dapp that gets the web3 object from window.web3 (the injected from metamask). When i disable de extention from chrome (not removing, just disabling) the web3 invocations are ...
1
vote
2answers
47 views

Payable function with additional value attached (web3, React)

I'm making a React frontend for an open-source blockchain protocol for tokenized hedge funds. So the question is how to provide the payable function that requires some other value attached (n this ...
1
vote
1answer
18 views

is there any method convert mutiple params to one bytes in web3js ,and then get these original data from bytes in solidity?

eg: the params in js code below,how to convert to one bytes var min=100; var max=100000000000; var price=1000000000000000000000000000; var name="john"; in solidity code below,how to get original ...
0
votes
2answers
30 views

How to backup POA based ethereum private blockchain and restore it in a fresh new environment

Is there a way to backup the POA based ethereum private block-chain [created from microsoft azure POA template] and also restore it in a all new environment with out loosing any transactions & ...
1
vote
0answers
32 views

Finding total transaction count (confirmed + pending) using web3.js [duplicate]

I am using web3.js version 0.20.6. I want to find the total transaction count so that I can set my nonce correctly. Currently, I am calculating the number of transactions in the following manner: ...