title: How to correctly sign the transfer of tokens through the smatcontract?
body: <p>I have <a href="https://hardhat.org/tutorial/writing-and-compiling-contracts.html" rel="nofollow noreferrer">smartcontract</a> with method transfer:</p>
  <pre><code>function transfer(address to, uint256 amount) external {
      require(balances[msg.sender] &gt;= amount, &quot;Not enough tokens&quot;);
      balances[msg.sender] -= amount;
      balances[to] += amount;
  }
  </code></pre>
  <p>After deploy via <a href="https://hardhat.org/tutorial/deploying-to-a-live-network.html" rel="nofollow noreferrer">HardHat</a> with account alchemy: &quot;https://eth-ropsten.alchemyapi.io/v2/iwxxx&quot;</p>
  <p>I got:
  Deploying contracts with the account: 0x5Cххх
  Account balance: 299502973995526766
  Token address: 0xC1ххх</p>
  <p>And run this code:</p>
  <pre><code>const acc_addr = &quot;0x5Cxxx&quot;;
  const address = &quot;0xC1xxx&quot;           
  const receiverAddress  = &quot;0x39xxx&quot;  
  
  
  var Web3 = require('web3')
  var provider = &quot;https://eth-ropsten.alchemyapi.io/v2/iwxxx&quot;;
  var web3 = new Web3(new Web3.providers.HttpProvider(provider));
  
  const token = new web3.eth.Contract(abi, address);
  token.setProvider(web3.currentProvider)
  
  token.methods.balanceOf(acc_addr).call((err, res) =&gt; {  
      log(&quot;balanse =&gt; &quot;, res); 
  });
  
  
  token.methods.transfer(receiverAddress, &quot;1&quot;).send({ &quot;from&quot;: acc_addr }, (err, res) =&gt; {
      if (err) {
        console.log(err);
        return
      }
      console.log(&quot;Hash transaction: &quot; + res);
  });
  </code></pre>
  <p>So I got error:</p>
  <blockquote>
  <p>Error: Returned error: Unsupported method: eth_sendTransaction.
  Alchemy does not hold users' private keys. See available methods at
  <a href="https://docs.alchemy.com/alchemy/documentation/apis" rel="nofollow noreferrer">https://docs.alchemy.com/alchemy/documentation/apis</a></p>
  </blockquote>
  <blockquote>
  <p>at Object.ErrorResponse (D:\node_modules\web3-core-helpers\lib\errors.js:28:19)</p>
  </blockquote>
  <p>I understand that I somehow have to sign this transaction. But the question is, I don’t understand how?</p>
  <p>Normal transactions of transferring ETH from an address to an address are very simple and obvious.</p>