I have deployed a contract as follows and determined its balance to be 5000 wei (value: 5000
):
const thisContract = new web3.eth.Contract(abi);
thisContract.deploy({
data: bytecode,
arguments: [ "0x84f0c8fC2F6bc8394EB77BaAAe89cB6e12C048C2", 86400]
}).send({
from: "0x3455D7167A2EE2d660EE85F8e90C6b3B1cCB7163",
gas: 5000000 ,
gasPrice: '3000000000',
value: 5000 // here I have determined the balance.
}, function(error, transactionHash) {
console.log(error);
console.log(transactionHash);
console.log('function exec');
}).then(function(newContractInstance) {
console.log('Contract Instance:' + newContractInstance.options.address);
});
I have deployed this contract on Tobalaba
blockchain (its github is here.)
The balance of the address by which I developed this contract is 20000000000000000000 wei
as follows :
> web3.eth.getBalance('0x3455D7167A2EE2d660EE85F8e90C6b3B1cCB7163').then(console.log)
Promise {
<pending>,
domain:
Domain {
domain: null,
_events:
{ removeListener: [Function: updateExceptionCapture],
newListener: [Function: updateExceptionCapture],
error: [Function: debugDomainError] },
_eventsCount: 3,
_maxListeners: undefined,
members: [] } }
> 20000000000000000000
However, when I get the balance of the contract, it's 0
as follows:
> web3.eth.getBalance('0xd227398f81bad20882b46ccdffc71058025df341').then(console.log)
Promise {
<pending>,
domain:
Domain {
domain: null,
_events:
{ removeListener: [Function: updateExceptionCapture],
newListener: [Function: updateExceptionCapture],
error: [Function: debugDomainError] },
_eventsCount: 3,
_maxListeners: undefined,
members: [] } }
> 0
And here is the information of deployment of this contract:
https://tobalaba.etherscan.com/address/0xd227398f81bad20882b46ccdffc71058025df341
Acoording to which the contract address is 0xD227398f81bAD20882B46ccdFfC71058025df341
Is something wrong?
IMPORTANT NOTE: I have developed this contract: https://programtheblockchain.com/posts/2018/02/23/writing-a-simple-payment-channel/
Meanwhile, when I get the contract address it returns null!
> thisContract.options.address
null
Whereas, regarding to this information (https://tobalaba.etherscan.com/tx/0xb9834bd2ebbbb930208dbb17462169441c6b63542a01a43e3992ecf803cb0734) it have to be deployed, isn't it ? (Please see the screen shot bellow)
Best Answer