1

I have been requested to create a demo for sending transactions using Ethereum and nodeJS, I am new to this cryptocoins world so I have some doubts:

  1. I need to do transactions without using contracts. Most information I have found uses contracts. is that possible?

    So far I have found web3js library to connect to a local node:

    var web3 = require('web3');
    var w3 = new web3(new web3.providers.HttpProvider("http://localhost:8545"));
    

    I Also have found previous questions with examples to sendTransactions but they use Contracts:

    https://ethereum.stackexchange.com/questions/25839/how-to-make-transactions-using-private-key-in-web3
    
  2. I need to estimate the fee to for the transaction. When working with Bitcoins, there were pages like: https://bitcoinfees.earn.com/api/v1/fees/recommended which give you a price per byte, then you got the amount of utxos to cover the transaction and used that for getting the transaction size which multiplied by the fee per byte gave you the estimated fee.

I read in ethereum you use a different currency for transactions than for fees (ether and gas) how to I calculate it? is there an api?

Thanks in advance for your help.

Eduardo
  • 231
  • 2
  • 11

1 Answers1

2

Regarding the first one. It is perfectly possible to simply send transactions. Actually, calling a contract is nothing else than sending a transaction to a contract address with some carefully encoded information in the data field (see rawTransaction)

For simply sending a transaction, geth provides the method

sendTransaction(...)

That does the job you are looking for.

Considering the fee estimation, this web is your perfect companion. I recommend that you read this other question

ranchalp
  • 540
  • 2
  • 12
  • maybe you can help me with this other question: https://ethereum.stackexchange.com/questions/33473/web3-sendsignedtransaction-transaction-cost – Eduardo Dec 15 '17 at 15:41
  • Using web3 the function to use is: sendSignedTransaction. http://web3js.readthedocs.io/en/1.0/web3-eth.html?highlight=gettransactioncount#sendsignedtransaction – Eduardo Dec 15 '17 at 15:42
  • can you help me with another question please? https://ethereum.stackexchange.com/questions/34071/ethereum-parity-balance-0-and-same-nonce – Eduardo Dec 21 '17 at 15:51