CryptoFly.us | CRYPTOCURRENCY BITCOIN SHIRTS CLOTHING APPAREL HATS

CRYPTO NEWS

SEC Chair Gary Gensler responds to concerns about first Bitcoin-linked ETF

In the same interview, Proshares CEO Simeon Hyman opined that regulated futures traded in a 40-act ETF will open the opportunity to get BTC exposure to a lot of folks who may have been waiting on the sidelines.

Adding Wallet using web3.eth.accounts.wallet.add

On web3 0.20.1, I am using Infura to deploy a contract to Rinkeby. This probably requires me to add a wallet to web3.accounts to provide the gas needed. When I ran the following nodejs code, Web3 = require(‘web3’) var web3 = new Web3(new Web3.providers.HttpProvider(“https://rinkeby.infura.io/nyxynyx-api-key”)) var privateKey = ‘nyxynyx-private-key’ web3.eth.accounts.wallet.add(“0x” + privateKey); var contractCode = ‘60606-contract-code-here’;::Listen

On web3 0.20.1, I am using Infura to deploy a contract to Rinkeby. This probably requires me to add a wallet to web3.accounts to provide the gas needed.

When I ran the following nodejs code,

Web3 = require('web3') var web3 = new Web3(new Web3.providers.HttpProvider("https://rinkeby.infura.io/nyxynyx-api-key")) var privateKey = 'nyxynyx-private-key' web3.eth.accounts.wallet.add("0x" + privateKey);  var contractCode = '60606-contract-code-here'; var abi = [{"constant":false,"inputs":[{"name":"givenNumber","type":"uint8"}],"name":"setNumber","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"givenNumber","type":"uint8"}],"name":"guessNumber","outputs":[{"name":"","type":"bool"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"SetNumber","type":"event"}]; GuessNumber = web3.eth.contract(abi) var contractInstance = GuessNumber.new({from: web3.eth.accounts[0], gas: 200000, data: '0x' + contractCode}); 

the following error is encountered:

web3.eth.accounts.wallet.add("0x" + privateKey);                         ^  TypeError: Cannot read property 'add' of undefined 

Is this because web3.eth.accounts.wallet.add is a web3 v1.0 function? If it is, what is the equivalent code needed in v0.20.1?

SEC Chair Gary Gensler responds to concerns about first Bitcoin-linked ETF

Shopping cart
There are no products in the cart!
Continue shopping
0