2

Building transactions with ethereumjs-tx and I'm confused as to why the from address is not included in the transaction. The transaction parameters are:

• nonce - transaction nonce

• gasPrice

• gasLimit

• to - to Address

• value - amount to be sent

• data

• chainId - EIP 155 chainId - mainnet: 1, ropsten: 3

And the private key is used to sign the constructed transaction. But how does the ethereum network know from who to deduct the money from?

1 Answer 1

1

Each transactions is signed, and the signature includes enough information to determine who signed it.

4
  • How though? What if the user is using an HD wallet which has many addresses (aka accounts) for a single private key? How does the network know from which account to deduct the balance from? What if they are both on the same transaction nonce number as well?
    – arshbot
    Mar 4, 2018 at 0:39
  • An HD wallet uses a seed to generate many accounts. Each account has its own private key. The transaction is signed with one of those private keys, which uniquely identifies the address of the account.
    – user19510
    Mar 4, 2018 at 0:52
  • So you're saying you don't sign the transaction with the master private key in ethereum? But instead with the private key of the address node? In which case (a bit off topic sorry!) the master private key is only useful for recreating the HD wallet tree and is not useful for signing?
    – arshbot
    Mar 4, 2018 at 0:54
  • 1
    That's correct. See github.com/bitcoin/bips/blob/master/bip-0032.mediawiki if you want all the gory details.
    – user19510
    Mar 4, 2018 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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