web3js

Send signed transactions to Ropsten or Truffle develop network with Trezor (Hardware Wallet)

谁说胖子不能爱 提交于 2019-12-04 16:23:59
问题 Im trying to integrate web3js with Trezor in a truffle dev network or using ropsten test network . The idea is to sign the transactions using the hardware wallet and then send a raw transaction using web3js Im getting that we dont have balance to make the transaction, probably because web3js isnt taking one of the 10 truffle accounts and is using the trezor address that isnt in my local network .. On ropsten i have some ethers and i get "invalid address" Is there a way to send a signed

Send signed transactions to Ropsten or Truffle develop network with Trezor (Hardware Wallet)

白昼怎懂夜的黑 提交于 2019-12-03 10:19:13
Im trying to integrate web3js with Trezor in a truffle dev network or using ropsten test network . The idea is to sign the transactions using the hardware wallet and then send a raw transaction using web3js Im getting that we dont have balance to make the transaction, probably because web3js isnt taking one of the 10 truffle accounts and is using the trezor address that isnt in my local network .. On ropsten i have some ethers and i get "invalid address" Is there a way to send a signed transactions (with trezor) using web3js into a truffle develop network? i mean, is there a way to include the

How to get a value from a “Promise” object

女生的网名这么多〃 提交于 2019-12-02 10:46:57
I started learning ethereum and web3js and noticed some functions on Web3js are asynchronous. What i want to achieve is get the account balance of a wallet and use the data for something else. My code below function getAccountBalance2(address){ var wei, balance //address = document.getElementById("addy").value return new Promise(function(resolve, reject){ web3.eth.getBalance(address, function(error, wei){ if(error){ console.log("Error with address"); }else{ var balance = web3.fromWei(wei, "ether"); var bal = resolve(balance); //console.log(bal); console.log(balance.toNumber()); return balance

calling smart contracts methods using web3 ethereum

為{幸葍}努か 提交于 2019-11-30 13:58:20
问题 Trying to work around the blockchain using Ethereum, I'm facing problems when trying to interface with a deployed contract. What I would try to achieve is to call a method to display information added to a private blockchain deployed locally using Geth. I can't call any function from my smart contract and I've been wondering if I'm doing something wrong... Could someone tell me how to achieve a simple call to one of the method from this contract? let say display the existing agencies, or the

calling smart contracts methods using web3 ethereum

时光总嘲笑我的痴心妄想 提交于 2019-11-30 09:20:30
Trying to work around the blockchain using Ethereum, I'm facing problems when trying to interface with a deployed contract. What I would try to achieve is to call a method to display information added to a private blockchain deployed locally using Geth. I can't call any function from my smart contract and I've been wondering if I'm doing something wrong... Could someone tell me how to achieve a simple call to one of the method from this contract? let say display the existing agencies, or the agency name from which the user is part of. My contract: agency.sol pragma solidity ^0.4.18; // We have

How to authenticate and send contract method using web3.js 1.0

馋奶兔 提交于 2019-11-30 05:26:27
I am confused about how I should be executing a contract's method using the web3 1.0 library. This code works (so long as I manually unlock the account first): var contract = new web3.eth.Contract(contractJson, contractAddress); contract.methods .transfer("0x0e0479bC23a96F6d701D003c5F004Bb0f28e773C", 1000) .send({ from: "0x2EBd0A4729129b45b23aAd4656b98026cf67650A" }) .on('confirmation', (confirmationNumber, receipt) => { io.emit('confirmation', confirmationNumber); }); I get this error (if I don't unlock manually first): Returned error: authentication needed: password or unlock The above code

How to authenticate and send contract method using web3.js 1.0

白昼怎懂夜的黑 提交于 2019-11-29 03:56:24
问题 I am confused about how I should be executing a contract's method using the web3 1.0 library. This code works (so long as I manually unlock the account first): var contract = new web3.eth.Contract(contractJson, contractAddress); contract.methods .transfer("0x0e0479bC23a96F6d701D003c5F004Bb0f28e773C", 1000) .send({ from: "0x2EBd0A4729129b45b23aAd4656b98026cf67650A" }) .on('confirmation', (confirmationNumber, receipt) => { io.emit('confirmation', confirmationNumber); }); I get this error (if I