This is a simple contract I am trying out with an Ethereum testrpc
instance.
pragma solidity ^0.4.11;
/// @title List
// Begin contract defintion
contract List {
struct ListMembers {
bytes32 listOwner;
bytes32[] members;
uint256 rNumber;
uint256 aNumber;
uint256 uNumber;
}
ListMembers public lm;
mapping (bytes32 => bool) public addedMembers;
function List(bytes32 listOwner) {
lm.listOwner = listOwner;
lm.rNumber = 10000;
lm.aNumber = 0;
lm.uNumber = 0;
}
}
And, this is the web3.js
code to deploy the contract.
var Web3 = require('web3');
var fs = require('fs');
//
var ethHttpProvider = new Web3.providers.HttpProvider("http://localhost:8545");
var web3 = new Web3(ethHttpProvider);
var abiFile = fs.readFileSync('Lists.abi').toString();
var abiDef = JSON.parse(abiFile);
var byteCode = fs.readFileSync('Lists.bin').toString();
//
var listContract = web3.eth.contract(abiDef);
deployedContract = listContract.new('A',{data: byteCode, from: web3.eth.accounts[0], gas: 4700000});
//
And, this is the error I am getting:
TypeError: value.forEach is not a function
What am I missing?
{data: '0x' + byteCode ...}
.listContract.new(['A'],...)
github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract