The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [nodejs]

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications.

Filter by
Sorted by
Tagged with
3
votes
2answers
171 views

USD Coin Balance Check By Web3

Now I am getting trouble on checking the USDC balance in my wallet address using web3. USDC is also said that it is ERC20 token, but when I checked the token contract ...
0
votes
0answers
35 views

web3.eth.sign() problem [duplicate]

I am using infura and web3 0.20.0 in back-end.(nodejs, I don't want to interact with metamask(front-end)) Now, I am facing a problem. I tried to use ERC865. solidity function ...
1
vote
3answers
38 views

How can i send data to Contract's function with sendTransaction?

i hava contract like this pragma solidity ^0.5.0; contract Sample { string public name = "sample"; function set(string memory _name) public { name = _name; } function get() ...
0
votes
2answers
62 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 ...
1
vote
0answers
26 views

Deploy script not working and not throwing any errors

const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); const { interface, bytecode } = require('./compile'); const provider = new HDWalletProvider( 'Mneomonic'...
1
vote
1answer
205 views

Error: Node error: {“code”:-32015,“data”:“Reverted 0x”,“message”:“VM execution error.”}

I deployed my smart contract on Kovan Etherium testnet. After that, I am trying to interact with smart contract methods using web3 1.0.0. Below is my node js code: var Web3 = require('web3'); var api ...
0
votes
0answers
160 views

Node: How Can I Import Web3 To Node.js?

I'm trying to import the web3 library in Node.js so that I can handle Ethereum smart contract events, however I can't get the import to work. I'm running Babel on each file to convert to es5, and the ...
0
votes
2answers
360 views

Solc error invalid opcode, but works in truffle

I am trying to compile solidity code in solc(nodejs) but unsuccessful so far. I have created a sample app for demo. Here is sample's directory structure (node.js and truffle combined): │ app.js │ ...
1
vote
2answers
104 views

How do I recover the address from message and signature generated with web3.personal.sign?

Is there any way to do that? To recover address in nodejs server-side from signature and message after it was signed with web3.personal.sign client-side? I tried this: https://ethereum.stackexchange....
1
vote
1answer
156 views

Using AbiEncoderV2 for encoding data in raw transactions

I've come across a use-case to need to pass a struct into a Solidity function. I know this can be done via tuples. However, I need to sign and send this transaction from my node.js back-end using ...
0
votes
1answer
86 views

Truffle contract.deployed does not get the latest instance deployed

I am developing a back-end DApp using truffle and nodejs on a private network. My application call Contract.deployed() and print the address of the obtained Contract. When I call truffle migrate --...
0
votes
0answers
20 views

Send Data into BlockChain Network using w3?

HI I want to store my bank information on ethereum network using w3. can anyone help me to send my data //Bank.sol pragma solidity >=0.4.21 <0.6.0; contract Bank { struct User {...
0
votes
1answer
52 views

Error while I am compiling the contract using node

saitejas-MacBook-Air:Inbox saitejakuruva$ sudo node compile.js assert.js:340 throw err; ^ AssertionError [ERR_ASSERTION]: Invalid callback specified. at wrapCallback (/Users/saitejakuruva/...
0
votes
1answer
47 views

How can i deploy compilled contract with node/web3 and metamask?

Does anybody knows how to deploy smart contract with node/web3 and using unlocked metamask account. I mean over internet it is advised to use HDWalletProvider with mnemonic but I want that user that ...
1
vote
1answer
39 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
74 views

How to get transaction receipt using transaction hash?

I deployed a smart contract and done some transactions. Now I want to see the transaction receipt of the transactions. So I wrote this code: var Web3 = require('web3'); var web3 = new Web3(new ...
1
vote
1answer
174 views

HDWalletProvider & truffleconfig: 'truffle migrate' will compile but not do anything else

I am trying to build a React app with Truffle. Firstly, my file structure is like so, with root_dir being the project root directory: root_dir/node_modules/src/libs/truffle All of truffle's files, ...
1
vote
0answers
140 views

metamask and infura - Managing and signing with private keys

I am using Infura as a node for my DApp so I need to send raw transactions by signing them. These transactions can come from multiple users of an application so each user must sign and send a raw ...
0
votes
0answers
27 views

Can I avoid metamask popups with calls to a server-side js script in order to pay for transactions?

I have a dapp that allows a user to input some info via the GUI, and this info is stored to the blockchain(testnet for now) when the user presses a button. This naturally incurs a cost, which causes ...
0
votes
1answer
211 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
269 views

How to compile Solidity ^0.5.5 contract with Node.js?

I am terribly new in Solidity and now I try to learn how to compile a contract in Solidity ^0.5.5 (No versions below). I have the contract as follow (UsersContract.sol) pragma solidity ^0.5.5; ...
0
votes
0answers
14 views

How can I better set up automatic sending of ethereum from the first address to the second address when I receive any amount for the first one?

I use Node.js. Every 5 seconds I check the address balance using the function eth.getBalance. When I receive funds to the first address, the function of transferring funds to the second address is ...
1
vote
2answers
75 views

Can I trigger the execution of a js file from a smart contract?

I'm a noob at this, so excuse me if this is a ludicrous question.. I have a ReactJS app that interacts with a smart contract via web3. At a certain point, some data gets stored to the contract, by ...
1
vote
2answers
58 views

Trying to test the contracts fully

truffle(develop)> version Truffle v5.0.5 (core: 5.0.5) Solidity v0.5.0 (solc-js) Node v10.15.1 const ApprovalContracts = artifacts.require('../../contracts/ApprovalContracts.sol'); contract ('...
0
votes
1answer
40 views

how to use backup node in web3 connection?

node1= running on port 8545 => current synced block is 2000, and node2= running on port 3545 => current synced block is latest When i am using web3 into another page and print web3 object it ...
0
votes
0answers
94 views

How to use multiple app.js in truffle project?

I'm new to blockchain and currently developing small application for educational purpose using solidity. I am using truffle framework and stuck at a point. currently there is only one app.js file in ...
0
votes
1answer
70 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
1answer
150 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 ...
3
votes
3answers
467 views

web3.eth.Contract(abi, address) doesn't return contract instance

i'am trying to make a instance of my contract in js using web3, but when I use the function web3.eth.Contract(abi, address) the result is not the expected(I take the ABI from remix). this is the code:...
1
vote
2answers
80 views

Create a blockchain platform to store students and its degree results on it [closed]

I would like to create a application on blockchain where i will store all students data and their results on blockchain So anyone having a idea how can i do that or is that feasible to create a that ...
0
votes
1answer
544 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
1answer
28 views

Web3 1.0 Nested contract promises

What is the best way to handled nested contract call with web3 1.0? I'm trying to collect all data needed and format it into something useable. It could require 2 or 3 calls though. Is there a easy ...
0
votes
0answers
81 views

Debugging a reverted transaction

I have two wallets: Wallet1: 0x8882528C7104e146E0500203C353C09922575385 Wallet2: 0xddCf0FeC78b5a20B9138F5DDb1357E3B60026a67 Each of them has more than 1 Ropsten ETH. Using web3js and Infura ...
1
vote
1answer
38 views

How to resolve 'ethereumjs-testrpc@beta' error while using 'npm –g install ethereumjs-testrpc@beta' in Nodejs command prompt

While setting up my Solidity Environment Using NodeJS, Node Package Manager (NPM) and Truffle which was successfully installed. But at the point of running "npm –g install ethereumjs-testrpc@beta" I ...
0
votes
0answers
569 views

TypeError: Cannot read property 'slice' of undefined

web3.eth.accounts.signTransaction(transactionObject, process.env.WALLET_PRIVATE_KEY, function (error, signedTx) { if (error) { log(`${error}`.red); } else { web3.eth....
1
vote
1answer
409 views

How to compile solidity files in nodejs using solc@0.5.4? [duplicate]

I am using node@10.14.2 and solc@0.5.4 to compile solidity files using the following code: var solc = require('solc'); var input = { language: 'Solidity', sources: { 'Bon.sol':{ content:...
0
votes
0answers
57 views

Get the result back of a smart contract function call using INFURA

This is the function I use to send a signed transaction using Infura to invoke a smart contrac function (see details for the params of the transaction). web3.eth.sendSignedTransaction('0x' + ...
0
votes
0answers
103 views

UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: The field to must have byte length of 20

I'm encountering a problem that I'm not able to solve. The code should launch a configured transaction with the details object. The current configuration is set to Ropsten and I am using the INFURA ...
0
votes
1answer
171 views

infura don't catch event [duplicate]

when i'm working on ganache all event that i have emit are store in my nodejs server but when i turn to kovan or ropsten my server don't catch event . i'm working with infura this my code no ...
1
vote
1answer
320 views

Cannot connect to ganache-cli with web3 and nodejs

from package.json: "ganache-cli": "^6.3.0", "web3": "^1.0.0-beta.41", in my createContract.js const Web3 = require("web3"); const ganache = require("ganache-cli"); console.log('ganache.provider :', ...
0
votes
1answer
89 views

How to send raw transaction if I don't have private Key but I know my password?

I am doing raw transaction to send token from one account to another. But I don't have private key of my account but i do have the password. How can I send raw transaction using my password only. Here ...
0
votes
0answers
39 views

Error in establishing the connection between Geth and Api (Invalid JSON RPC response)

For my test project, I have my geth running in main server(rpc port-8117). The api(node.js), which is used to interact with the geth is present in the other system. In the api, I have given the http ...
0
votes
1answer
100 views

How to deploy a dapp which uses multiple blockchain

I am a newbie and started learning dapp on ethereum. Up till now, I wrote smart contracts; created frontend with html, css and js; deployed smart dapp on either private network(geth, ganache) or ...
0
votes
0answers
150 views

To transfer tokens using google cloud function

I am transferring token to the User's wallet when they create account. For that I am using google cloud functions. Here, on the account creation event, tokens will get transferred to the address. My ...
0
votes
1answer
37 views

How to configure APIs to run with Ropsten addresses

I have my contracts deployed on Ropsten network. I deployed those contracts from my local machine using Truffle migrate. Then I set up an AWS EC2 Ubuntu server to host my RESTful APIs. I installed ...
3
votes
1answer
2k views

How to call contract functions using web3?

I have deployed my contract in private blockchain, now I am calling functions using Nodejs and web3. Here, I want to transfer tokens for which I need to unlock my account from which I am transferring ...
0
votes
1answer
93 views

Doubt with ethereum-input-data-decoder when decoding a variable uint256

the input data of the variable uint256 is "22092018" but when using ethereum-input-data-decoder I return "BN: 15118f2". Instead of getting "BN: 15118f2" with the decoder, have the original value of ...
0
votes
0answers
525 views

FATAL ERROR: Rebalance Allocation failed - process out of memory

So while running truffle compile for my contracts on AWS Ubuntu server I got the following error: <--- Last few GCs ---> [17055:0x3985730] 11958 ms: Scavenge 511.7 (553.4) -> 506.9 (553.4) ...
1
vote
1answer
447 views

how to upload file into ipfs from node js without uploading files into node js server [closed]

I need to upload multiple files into ipfs from node js. Flow: file(html,angularJS) --> node.js --> IPFS --> ipfs hash save into DB. I have sent a file from HTML(angularJS) and I got the ...
0
votes
2answers
51 views

Web3 js APIs Installation Requirements

If I am using Infura Node interact with smart contracts. And I want to build/setup web3 apis on a ubuntu machine on AWS. Do i need to install truffle on that machine or just node.js and web3 is enough?...