I have smart contract deployed that accepts funds (via fallback function function() payable { ... }
). Also I have frontend using web3 to send funds.
When I tested it with local node (and JSON wallets presented locally) evrything works fine - web3.personal.unlockAccount(account, password)
unlocked account with data provided by user then funds sent to contract.
Now I deployed geth
node on standalone VPS and connecting to it using code:
var Web3 = require('web3');
this.web3 = new Web3();
this.web3.setProvider(new Web3.providers.HttpProvider('http://my-node-addr.net:18545/'));
if(this.web3.isConnected()) {
console.log('web3 connected');
} else {
console.log('web3 NOT connected');
}
It shows that client connected successfully. But when I am trying to send funds code failed on line
web3.personal.unlockAccount(account, password);
with error Error: no key for given address or file
. Of course, my node cannot contain all client's wallet file (nobody want to upload it).
Here is how I am sending transaction:
this.contract.sendTransaction({ from: account, value: amount, gas: 400000 })
.then(() => {
// OK, everything fine!
})
.catch(error => {
// I am here
console.log('Oops...', 'Error happened during your payment: ' + error, 'error');
});
UPD: What I want: provide html page with fields "account", "password" and "amount" that allows users to send ethers to predefined address. Of course my node will not have UTC-.....
files (wallets).