Q:

How can I make other people's account to do ether transactions with smart contract?

I was making a smart contract which involves people to buy tokens in exchange of ether they send. It works fine in testrpc as all accounts are unlocked, but how do I do it for actual accounts in main network using web3 in nodejs. What fields would be required to invoke these payable functionalities of smartcontract except the wallet address ofcourse? Any code snippets or examples? Any help would be appreciated. Thanks.   

A:

A few points to help you separate issues and clarify thinking. 
A contract cannot do anything that a normal user can't do. For example, there's nothing you can program to make a contract spend someone else's money. 
All action on the blockchain starts with an "Externally Owned Account" "signing" and transaction. Contracts can talk to each other, but they never do anything until someone sends a signed transaction, so those "messages" are in another category ("messages"). 
Signing is done by wallets using secret keys. Without the secret, signing is not possible. But anyone who acquires the secret (somehow) can sign on behalf of another address. 
When you're using TestRPC, "the" user has 10 different addresses. They are his addresses, not strangers. He's got the secret keys. TestRPC simply makes it convenient to unlock the accounts and spend as you go. You would not be able to make up an 11th address and spend from it without the corresponding secret. 
In the case of a website, there are two (general) solutions. 

The website can create the accounts and (safely!) keep the secret keys. That would be like opening the accounts "on behalf of" the users. Consider how Exchanges operate. 
The browser can rely on the users' local Ethereum or MetaMask so it is (in fact) the user and not the web server that signs transactions and sends them to the chain. Consider the Mist Wallet contract. 

Hope it helps. 

