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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.