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("./helpers.js")

var Web3 = require('web3');
var Tx = require('ethereumjs-tx');

// You should be running a local Eth node or use Infura.
var web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io:443"));
var prompt = require('prompt');


var sendingAddress = "********************"  // with your sending ETH address
var pKey = "******************************"; // This will store the corresponding private key.  we'll be getting the private key for this Eth address from a command prompt


// Keep track of kitties we'll mine to avoid double-mining
var kittyArray = []

var theNonce = "";
// Gas price.   Todo: Use Eth gas station Oracle to predict gas prices
var gwei = '26'

// Track # of received
var num_requested = 0
var num_received = 0

I thought maybe the issue is running on Infura port 443.


回答1:


Simple solution

Voting.options.address = "0x6ee9957aef5f4073c6af71441ec7962527c37671"

where Voting is my smart contract instance name

"0x6ee9957aef5f4073c6af71441ec7962527c37671" is deployed smart contact address

my web3.js version "web3": "^1.0.0-beta.31",



来源:https://stackoverflow.com/questions/48609913/unhandled-rejection-error-this-contract-object-doesnt-have-address-set-yet-pl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!