If i want write a smart contract with having a ether balance what should i do?
for example writing a smart contract that send a ether to a address.
If i want write a smart contract with having a ether balance what should i do?
for example writing a smart contract that send a ether to a address.
If you create a contract, you can then send ETH to it in another transaction. Contracts by default have the ability to store ETH. You just have to code the ability for it to do something with that ETH.
when you create a smart contract you need to send some ether to it, you can't add ether balance when you creating it.
the contract its empty as when created ETH Wallet
Well, there is a hacky way of doing just that. Ethereum contract address is deterministic, i.e. knowing the creator's address and their nonce you can calculate the future address of your smart contract. And then send ETH to that address prior to deploying the contract. From here: How is the address of an Ethereum contract computed?