web3js

Create an account with web3.js v0.2.6

爱⌒轻易说出口 提交于 2019-12-13 03:38:58
问题 so everytime i try to create an account with web3 i always get errors like the wrong version of web3 and that i should switch to v1.0.0 i used this command to install web3 npm install ethereum/web3.js --save i ve tried these commands to create an account but there is always a mismatch web3.eth.accounts.create(); web3.eth.personal.newAccount('!@superpassword') .then(console.log); and i always get errors even though i installed npm install web3-eth-account --save npm install web3-eth-personal -

How to integrate smart contract via web3 and infura provider

◇◆丶佛笑我妖孽 提交于 2019-12-11 07:36:33
问题 I have created a project with infura provider const web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/07630919731949aa87a45b96c98a834d')) And I try to call a smart-contract's method { to: addressTo, from: addressFrom, data: { name: 'addWhitelisted', inputs: [{ name: 'account', address: '0x57e755461FF79176fC8f14B085A8CBb4AE1fC2f6' }] } } Then I need to sign a transaction and call web3.eth.sendSignedTransaction ? But when i sign i get an error. Pls help. What I'm

Web3.js sendSignedTransaction gives “Error: Failed to check for transaction receipt”

Deadly 提交于 2019-12-11 05:59:46
问题 I am using web3js v1.0.0-beta.34 to send signed transactions to a geth node Geth/v1.8.13-unstable-2e0391ea/linux-amd64/go1.10.3 in a loop. Problem: In the initial iterations of the loop, Node.js prints the transaction hash to console. But when the loop has been running for more than a handful of seconds, we start to get the error: Error: Failed to check for transaction receipt: {} at Object._fireError (/Users/x/test/node_modules/web3-utils/src/index.js:56:17) at /Users/x/test/node_modules

Integrating web3 in cloud functions module

一个人想着一个人 提交于 2019-12-11 04:35:58
问题 I'm trying to integrate web3 (using truffle) in a cloud functions module and I keep getting this error: Error: Invalid JSON RPC response: "" Here is part of the implementation: admin.initializeApp(functions.config().firebase); const db = admin.database(); const provider = new HDWalletProvider(mnemonic, infura link); const web3 = new Web3(provider); As Far as I understand, the error indicates that truffle library is unable to establish a connection to the ethereum network. I wonder if this has

Remix Ethereum where goes the contract?

核能气质少年 提交于 2019-12-11 04:24:58
问题 I don't understand where actually the smart contract goes, when I click on create under remix.ethereum.org. If I choose for example the Injected Web3, this should publish the contract to the ropsten test net, right? But how can I access the contract then? When I use metamask it injects me the right provider when I use web3.js, but how can I find this contract now, if I don't want to use the injected web3, but manually choose the provider address in web3.js? Can I access the smart contract

What is the difference between web3.eth.accounts.create and web3.eth.personal.newAccount

荒凉一梦 提交于 2019-12-11 02:38:50
问题 As I understand when using web3.eth.accounts.create(), it doesn't add the account to chain (I'm using ganache-cli for testing), but web3.eth.personal.newAccount() does. Is it the main purpose or is it a bug? Is there other differences? web3.js version: 1.0.0-beta.34 回答1: Both versions create a new account on the blockchain. The difference is how you interact with the node and having access to the private key. If you have a local node, you can use web3.eth.accounts.create which will create the

Unable to resolve module crypto in reactnative

天大地大妈咪最大 提交于 2019-12-09 18:47:31
问题 I have posted this here have created react-native app using react-native init myapp added web3 in package.json npm install react-native run-ios but i am getting the error unable to resolve module crypto from web3-eth-accounts. Is there any way to fix this unable to resolve crypto 回答1: Crypto is a node js module, when React Native is run - it uses Javascript Core. Crypto isn't include within this. When I installed crypto I used the following package: https://www.npmjs.com/package/react-native

Unhandled rejection Error: This contract object doesn't have address set yet, please set an address first

一曲冷凌霜 提交于 2019-12-08 19:42:14
问题 Im currently trying to use Infura to run on my machine thru Web3. When I set to run my node index.js file I get the following error: Unhandled rejection Error: This contract object doesn't have address set yet, please set an address first. at Object._processExecuteArguments (/Users/Oso.Lu/cryptokitty-miner/node_modules/web3-eth-contract/src/index.js:739:15) at Object._executeMethod (/Users/Oso.Lu/cryptokitty-miner/node_modules/web3-eth-contract/src/index.js:760:54 var helpers = require(".

Repeating transactions hangs - web3js, local geth

為{幸葍}努か 提交于 2019-12-07 08:25:44
问题 I have an issue with transactions on my local ethereum network - at some point, transaction hangs & spends a lot of ETH from my account. Here's a sample code: async function send(toAccount, weiVal) { let account = await w3.getDefAccount(); for (let i = 0; i < 100; i++) { let res = await web3.eth.sendTransaction({ from: account, to: toAccount, value: weiVal }); await helper.timeout(2000); } } send('0x5648...', 100000000000000); It hangs at sendTransaction call (promise is never resolved) on

Repeating transactions hangs - web3js, local geth

旧巷老猫 提交于 2019-12-05 17:34:32
I have an issue with transactions on my local ethereum network - at some point, transaction hangs & spends a lot of ETH from my account. Here's a sample code: async function send(toAccount, weiVal) { let account = await w3.getDefAccount(); for (let i = 0; i < 100; i++) { let res = await web3.eth.sendTransaction({ from: account, to: toAccount, value: weiVal }); await helper.timeout(2000); } } send('0x5648...', 100000000000000); It hangs at sendTransaction call (promise is never resolved) on some random iteration. The situation remains the same after script restart - transaction passes a few