未处理的拒绝错误:此合同对象尚未设置地址,请先设置一个地址 [英] Unhandled rejection Error: This contract object doesn't have address set yet, please set an address first

查看:441
本文介绍了未处理的拒绝错误:此合同对象尚未设置地址,请先设置一个地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用Infura通过Web3在我的机器上运行。当我设置运行我的 node index.js 文件时,出现以下错误:

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

我以为问题出在Infura端口443上。

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

推荐答案


简单解决方案

Simple solution



Voting.options.address = "0x6ee9957aef5f4073c6af71441ec7962527c37671"

其中投票是我的智能合约实例名称

0x6ee9957aef5f4073c6af71441ec7962527c37671 部署的智能联系人地址

"0x6ee9957aef5f4073c6af71441ec7962527c37671" is deployed smart contact address

我的web3.js版本
web3: ^ 1.0.0-beta .31,

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

这篇关于未处理的拒绝错误:此合同对象尚未设置地址,请先设置一个地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆