How i can send one ETH from my one wallet to another wallet using API.
You need an ethereum node (geth or parity). You can host your own node or use a third party node (I am not sure about any). You can then use web3.js to send transaction using api. A sample code could be like:
custom_func.prototype.SENDETHER=function(from,to,password,amount){
return new Promise(function(fullfill,reject){
web3.eth.personal.unlockAccount(from, password).then(function (result) {
web3.eth.sendTransaction({from:from,to:to,value:web3.utils.toWei(amount,"ether")})
.on('transactionHash', function(txHash){
console.log("Transaction hash : "+txHash);
fullfill(txHash);
}).catch(function(err){
console.log(err);
reject("Unable to send transaction");
});
}).catch(function(err){ //catch of unlock account
console.log(err);
reject("Unable to unlock sender's account with given passphrase");
});
});
}
f i have only one ETH in wallet can i send that ETH or i have to manage balance in my wallet, GAS fee will cost to me not?
You have to calculate gas by yourself. You can not send exact 1 ETH, if you have just 1 ETH in your account. You can calculate the eth for gas by given formula:
fee_in_wei = gas * gasPrice
For sending eth, gas in 21000 and let's say you decide to send a gas price if 3 GWei. So fee = 21000*3000000000 wei => 0.000063 ETH.
So amount you will send is 0.999937
. (Do check calculation by yourself).
I have Private key of account from which i have to send ETH.
If you want to send this to another wallet of yours, think about importing private key. Not sure if this is what you need.