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 [javascript]

JavaScript is a dynamic, weakly-typed language used for client-side as well as server-side scripting.

0
votes
1answer
8 views

How do I deposit Ether to Smart Contract using Web3.js

So I am creating a web application that interacts with a smart contract that I deployed on the Ropsten TestNet. I am able to withdraw ether from the contract to my Metamask account using a withdraw ...
1
vote
1answer
17 views

MetaMask ethereum.enable() not responding after logout. How to reactivate?

So I found out that after logging out of MetaMask. ethereum.enable() stop working and is not triggering the login prompt window. The only way to reactivate it, is by closing chrome, and start it once ...
0
votes
1answer
12 views

How to compare an address with an address using web3js?

I've been reading and trying but to no avail. I'm trying to compare the current wallet address in MetaMask with the wallet address which owns a certain token via a smart contract method "ownerOf" ...
0
votes
1answer
20 views

Stop listening to / watching a contract (Web3)

Here is what I am trying to do (Web3 1.0): Deploy a contract Wait until Nth confirmation. Then stop getting updates from the contract. My code: var myContract = new web3.eth.Contract(_abi, ...
0
votes
0answers
13 views

truffle-assertions: TypeError: Cannot read property 'filter' of undefined

There is a part of my Solidity code: event elo(address pAddress); function test() external { emit elo(m_Registry); } And a chunk of my test: const truffleAssert = require('truffle-...
0
votes
2answers
41 views

How to wait for balanceOf before I execute a transfer?

Ok, I'm new into JS and web3 and MetaMask. I'm still lost about Promise and async/await after reading them for 5 times! I want to call my smart contract balanceOf method to check if there's enough ...
0
votes
0answers
19 views

Store data on ethereum blockchain from a text file

I have a simple smart contract running over a local Ethereum node. It has two functions: one for sending data and another for retrieving it back. I have a text file and want to send data from it to ...
0
votes
1answer
16 views

How to store and encrypt Keys?

I am developing chrome extension like metamask for the private Chain. I have generated the keys and using localStorage to store the Keys. But I am not sure whether I am going correct or not for ...
0
votes
0answers
12 views

How to run tronbox, i get this error code: 800A03EA? [closed]

I try to run tronbox compile --all after that i get the next alert, could someone help me?
1
vote
0answers
17 views

Base58 javascript implementation [closed]

I am using IPFS-multihash method to store IPFS hash in smart contracts. For that I need to decode base58 format: QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4 to binary(as hex): ...
0
votes
1answer
22 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
12 views

How to redirect to Etherscan website when transaction completes?

In my project, I am doing a transaction by using ethereum.send({ }) method from web3 in javascript using metamask. After the transaction completes I want to display the link to the user in label ...
1
vote
1answer
11 views

How to retrieve transaction hash value from the Promise object using web3js?

I'm trying to retrieve the transaction hash value after I call my smart contract method. My Promise object looks like below. returnPromise: Promise { "pending" } ​ <state>: "...
0
votes
1answer
21 views

SyntaxError: await is only valid in async functions and async generators in web3js

Below is my code snippet. I wish to wait for the transaction hash value so that I can return my Javascript function with the hash value. But I get the error "SyntaxError: await is only valid in ...
0
votes
0answers
9 views

What is the difference between web3.js and ethjs?

I've seen people using both in their codes - https://github.com/ethereum/web3.js and https://github.com/ethjs. Do I need both? Does ethjs depend on web3?
0
votes
0answers
25 views

MetaMask Calling Child Contract Methods?

I had created a contract(Organisation.sol) that create other contracts(Session.sol). When I call any method from(Organisation.sol) using web3js it work well. But If I ever tried to call any method ...
0
votes
1answer
24 views

How to deploy A contract created by another contract in the browser?

Hey I am making a smart contract that create another smart contracts. Organization.sol create Session.sol . When I create a session using createdSession function I got it's address and I already had ...
0
votes
2answers
46 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 ...
0
votes
0answers
12 views

Help needed: MetaMask crash reason?

I am experiencing an issue of MetaMask but I do not know how to track down if this is due to MetaMask itself or due to my dapp. Following problem: I load my webpage in Chromium on Linux and log in to ...
0
votes
1answer
23 views

.transfer fails

Trying to call .transfer() within a function makes it fail. I am aware that the difference between .send() and .transfer() is that .send dont throw. The function works properly when using .send(), but ...
1
vote
1answer
20 views

BigNumber Error: new BigNumber() not a number: [object HTMLInputElement]

Getting this Big Number error when trying to update my token price.Seems like a Javascript issue with the number size being passed.Anyone know a fix for this? //Javascript priceChange:function(){ App....
0
votes
1answer
19 views

How to connect with Metamask and Smart contract?

I am ready with my frontend design. I have only 3 files HTML, CSS, and JAVASCRIPT. So, I didn't create any project or DAPP to have other files. Now next step is to connect with metamask and smart ...
0
votes
0answers
35 views

How to call A child Contract function in web3js?

Hey I am new at blockchain development and I need to make contract name organization that create sessions contracts. I had already implemented the solidity code but I have a problem in front-end ...
1
vote
1answer
15 views

Metamas - Infura problem. Cannot read property 'currentProvider' of undefined

I got a problem. I am using code below to connect to the eth from node.js app. Everything works perfect as long as I have installed MetaMask in my browser. I can be logged in, logged out, all good ...
0
votes
0answers
32 views

why .call() in Truffle did not return results as expected?

I'm deploying a contract to my private chain and try to call the contract's function. After I got in the geth console and finished deploy contract, I called the function but it doesn't work ...
0
votes
1answer
13 views

Get “i” in asynchrounous request [closed]

I have a view-request which returns amount X and will then fire a function X times through a for-loop. It works everything but due to the asynchronous request, I do not get the correct i-value that ...
0
votes
1answer
27 views

Accessing one smart contract contained in another smart contract from javascript

I'm cross-posting this from Stack Overflow, since there seems to be more activity here. I am trying to develop a dApp with Truffle and want to test my smart contract. The contract contains a second ...
0
votes
0answers
36 views

How do I call my smart contract functions through web3 js?

So I am very new to Blockchain development so sorry in advance! I have deployed a very basic Smart Contract to the Ropsten testnet. I am developing a front-end and from here, I want to withdraw ether/...
1
vote
1answer
18 views

Is it possible for a contract to auto-execute a function every hour? [duplicate]

I have a contract with a manual function that checks the balance of the contract and if it's zero it changes certain values in mapping. How to make this happen automatically every hour?
0
votes
0answers
26 views

Error use account to deploy the smartcontract: Send

let accounts; let inbox; beforeEach(async () => { //get a list of all accounts accounts = await web3.eth.getAccounts(); //use one of those accounts to deploy the contract inbox = ...
1
vote
3answers
54 views

Do you need to use/learn Solidity to make smart contracts

I'm working on an API that sends multiple transactions out from one wallet. I realized I cannot do it without creating a smart contract the way Ethereum is structured which is actually quite a great ...
0
votes
1answer
36 views

Dealing with events in ethers.js

I'm trying to get a better understanding of arbitrary bytes parameters, so I wrote a one-function smart contract that accepts a bytes argument, decodes it, and returns the response. I am having ...
1
vote
1answer
14 views

How do I send multiple transactions from one wallet in Nodejs?

Hi I've been reading around and I came across Web3.js It's not apparent to me how I can send Ether from one wallet to multiple recipients other than in a batch-style request (which inevitably takes a ...
0
votes
1answer
26 views

How to prompt and create Smart Contract using React

Weird question, so I have created a smart contract, verified that it works, even deployed it using Web3, Metamask and HTML/Javascript. I understand that worked. Now I am trying to integrate it into ...
0
votes
0answers
28 views

Store data on ethereum block chain using react js

I'm trying to store data on ethereum blockchain by doing this import storemetadata from "./storemetadata"; where i have the smart contract ABI in storemetadata I now add name like so storemetadata....
0
votes
0answers
15 views

Error when calling Ethereum Contract

I am using a JS library which calls Solidity functions and I been getting the following error: 0x0c444aa3066f98d5f7ee576401e7729cb1113fe288d38711a78e48836313e88c App.js:112 TypeError: createLog is ...
0
votes
0answers
37 views

Smart contract migration through Proxy delegate pattern in solidity 0.5

I am trying to do smart contract migration in solidity 0.5 using the proxy delegate pattern. When I write the integration test in javascript how should i make a delegate call using the proxy contract ...
0
votes
1answer
112 views

Web3: web3.utils is undefined

I am kinda new to Ethereum and Web3 so I am trying to implement the Ethereum: Building Blockchain Decentralized Apps (DApps) tutorial. I have already installed web3 and web3-utils. npm view web3 ...
3
votes
2answers
112 views

Truffle Test Issue With `address payable` and Compiler Version

I am trying to run truffle test on an old contract which was written using pragma solidity 0.4.24;. While I am able to deploy the contracts using truffle migrate, I get the following error when ...
0
votes
1answer
47 views

How to sign a transaction using nodejs crypto?

I have a js client, web API Js client send some data in JSON format, API prepare a transaction to be send to a smart contract, than it returns transaction raw to client to be signed locally, and ...
0
votes
1answer
28 views

Truffle Test async problem [closed]

When I "truffle test" and the below runs, I get 1,3 as the output. How do I make everything happen in order, I want to force it to wait until dai is defined. const DAI = artifacts.require("DSToken"); ...
0
votes
1answer
40 views

Truffle - how to share variables and functions between test files? [closed]

I have files in Test directory, each one performs different test but all of them contain at least exactly the same functions "register" and "vote", also few arrays like votings = [], groups = [] and ...
0
votes
0answers
136 views

How to access the return value of function of ethereum contract using web3 in javascript?

I have written a basic hello world! smart contract and deployed using testrpc and truffle. I have a function in the contract that returns a value and i am using this function and the value it returns ...
0
votes
0answers
13 views

Is it possible to write to a file from a truffle console?

I am running some tests on my smart contracts and I need to gather a bunch of data to process in a spreadsheet. Is it possible to write to a file from the console?
0
votes
0answers
81 views

ipfs.files.add(Buffer) function causing TypeError: Cannot read property 'add' of undefined

I am trying to upload an image to ipfs using ipfs.files.add() function but it is causing me this error Uncaught TypeError: Cannot read property 'add' of undefined at App.onSubmit (App.js:70) at ...
0
votes
1answer
34 views

Making assertions (assert.equal) on two return values in Truffle

Appreciate any help I can get. I am trying to make an assertion on returned values from a smart contract, and I cannot figure out how to get it to work for a Truffle test. I cannot show all my code in ...
0
votes
1answer
386 views

web3.min.js is missing in ./node_modules/web3/dist

I am following the below tutorial to create implement blockchain using web3. https://medium.com/coinmonks/interacting-with-ethereum-smart-contracts-through-web3-js-e0efad17977 When I am using npm ...
0
votes
1answer
143 views

BigNumber Error: new BigNumber() not a base 16 number:

I'm new to Ethereum and javascript so hope someone can help me with this as none of the other answers on BigNumber help me understand why this won't work for me. I've tried converting the number to a ...
0
votes
1answer
220 views

How to deploy a smart contract using Infura and web3js@1.x.x on NodeJS?

I have an application written in NodeJS that each time it starts has to deploy a smart contract. Once the contract is deployed this application will interact with it making some transactions and ...
1
vote
0answers
28 views

Unable to retrieve ethereum address from the signed data

I used the web3.eth.accounts.recover method to retrieve the ethereum address but I am getting an error. Here is the code: let v = '0x' + signed_nonce.slice(130,134); let r = signed_nonce.slice(0,...