-
Notifications
You must be signed in to change notification settings - Fork 0
/
messenger_new.js
13 lines (12 loc) · 6.16 KB
/
messenger_new.js
1
2
3
4
5
6
7
8
9
10
11
12
var messengerContract = web3.eth.contract([{"constant":true,"inputs":[{"name":"_receiver","type":"address"}],"name":"get_latest_message","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":true,"inputs":[{"name":"_receiver","type":"address"}],"name":"get_counter","outputs":[{"name":"","type":"uint32"}],"type":"function"},{"constant":true,"inputs":[{"name":"_receiver","type":"address"},{"name":"index","type":"uint32"}],"name":"get_message","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_receiver","type":"address"},{"name":"_text","type":"string"}],"name":"send_message","outputs":[{"name":"","type":"bool"}],"type":"function"},{"inputs":[],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_receiver","type":"address"}],"name":"Message_sent","type":"event"}]);
var messenger = messengerContract.new(
{
from: web3.eth.accounts[0],
data: '60606040525b6001600060005060003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060000160006101000a81548163ffffffff0219169083021790555033600060005060003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060010160005060006001815260200190815260200160002060005060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550604060405190810160405280600b81526020017f48656c6c6f20576f726c64000000000000000000000000000000000000000000815260200150600060005060003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000506001016000506000600181526020019081526020016000206000506001016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061019a57805160ff19168380011785556101cb565b828001600101855582156101cb579182015b828111156101ca5782518260005055916020019190600101906101ac565b5b5090506101f691906101d8565b808211156101f257600081815060009055506001016101d8565b5090565b50505b6107ee806102076000396000f360606040526000357c0100000000000000000000000000000000000000000000000000000000900480634550accf1461005a578063c695d221146100de578063ec67229314610110578063f122ed601461019d57610058565b005b6100706004808035906020019091905050610212565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156100d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100f46004808035906020019091905050610368565b604051808263ffffffff16815260200191505060405180910390f35b61012f60048080359060200190919080359060200190919050506103b9565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f16801561018f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101fa6004808035906020019091908035906020019082018035906020019191908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509090919050506104c8565b60405180821515815260200191505060405180910390f35b60206040519081016040528060008152602001506000600060005060008473ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060000160009054906101000a900463ffffffff169050600060005060008473ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060010160005060008263ffffffff1681526020019081526020016000206000506001016000508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103565780601f1061032b57610100808354040283529160200191610356565b820191906000526020600020905b81548152906001019060200180831161033957829003601f168201915b50505050509150610362565b50919050565b6000600060005060008373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060000160009054906101000a900463ffffffff1690506103b4565b919050565b6020604051908101604052806000815260200150600060005060008473ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060010160005060008363ffffffff1681526020019081526020016000206000506001016000508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104b65780601f1061048b576101008083540402835291602001916104b6565b820191906000526020600020905b81548152906001019060200180831161049957829003601f168201915b505050505090506104c2565b92915050565b600060006000600060005060008673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060000160009054906101000a900463ffffffff1663ffffffff16111561058757600060005060008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050600001600081819054906101000a900463ffffffff168092919060010191906101000a81548163ffffffff02191690830217905550506105d4565b6001600060005060008673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060000160006101000a81548163ffffffff021916908302179055505b600060005060008573ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060000160009054906101000a900463ffffffff16905082600060005060008673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060010160005060008363ffffffff1681526020019081526020016000206000506001016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106106b857805160ff19168380011785556106e9565b828001600101855582156106e9579182015b828111156106e85782518260005055916020019190600101906106ca565b5b50905061071491906106f6565b8082111561071057600081815060009055506001016106f6565b5090565b505033600060005060008673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060010160005060008363ffffffff16815260200190815260200160002060005060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055507f8d384e9cc3a062a911354284ae326e5d1f0f08242055023fa054a4da9179ff8984604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1600191506107e7565b509291505056',
gas: 4700000
}, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})