Skip to main content
Commonmark migration
Source Link

In [eth-lightwallet][1]eth-lightwallet, there are two types of Tx creation functions;

txutils.valueTx(txObject) 

and

txutils.functionTx(abi, functionName, args, txObject) 

My guess is; although their inputs are very different, they both result in a Tx object that looks like this:

tx = { nonce: '..', gasPrice: '..', gasLimit: '..', to: '..', value: '..', data: '...' } 

and the only difference is that data is empty in valueTx, and it's the hex-encoded version of the function call in functionTx. Is this correct? Is data the only difference between two?

Also, how can I compute data myself, given that I know the contract address, abi and the function name/parameters? Is there another library for this?

Thanks, [1]: https://github.com/ConsenSys/eth-lightwallet

In [eth-lightwallet][1], there are two types of Tx creation functions;

txutils.valueTx(txObject) 

and

txutils.functionTx(abi, functionName, args, txObject) 

My guess is; although their inputs are very different, they both result in a Tx object that looks like this:

tx = { nonce: '..', gasPrice: '..', gasLimit: '..', to: '..', value: '..', data: '...' } 

and the only difference is that data is empty in valueTx, and it's the hex-encoded version of the function call in functionTx. Is this correct? Is data the only difference between two?

Also, how can I compute data myself, given that I know the contract address, abi and the function name/parameters? Is there another library for this?

Thanks, [1]: https://github.com/ConsenSys/eth-lightwallet

In eth-lightwallet, there are two types of Tx creation functions;

txutils.valueTx(txObject) 

and

txutils.functionTx(abi, functionName, args, txObject) 

My guess is; although their inputs are very different, they both result in a Tx object that looks like this:

tx = { nonce: '..', gasPrice: '..', gasLimit: '..', to: '..', value: '..', data: '...' } 

and the only difference is that data is empty in valueTx, and it's the hex-encoded version of the function call in functionTx. Is this correct? Is data the only difference between two?

Also, how can I compute data myself, given that I know the contract address, abi and the function name/parameters? Is there another library for this?

Thanks,

edited tags; edited title
Link
eth
  • 86.6k
  • 54
  • 289
  • 418

What eth-lightwallet: what is the difference between a functionTx and a valueTx?

Source Link
jeff
  • 2.6k
  • 2
  • 21
  • 41

What is the difference between a functionTx and a valueTx?

In [eth-lightwallet][1], there are two types of Tx creation functions;

txutils.valueTx(txObject) 

and

txutils.functionTx(abi, functionName, args, txObject) 

My guess is; although their inputs are very different, they both result in a Tx object that looks like this:

tx = { nonce: '..', gasPrice: '..', gasLimit: '..', to: '..', value: '..', data: '...' } 

and the only difference is that data is empty in valueTx, and it's the hex-encoded version of the function call in functionTx. Is this correct? Is data the only difference between two?

Also, how can I compute data myself, given that I know the contract address, abi and the function name/parameters? Is there another library for this?

Thanks, [1]: https://github.com/ConsenSys/eth-lightwallet