As web3.personal.signAndSendTransaction method, Is there any such method available for Contract functions? for example:


No, unfortunately.

What you have to do is to encode the contract signature and the parameters in the Application Binary Interface (ABI) format, then send this data in the data parameter of the web3.personal.signAndSendTransaction function.

See the data parameter in JavaScript API - web3.eth.sendTransaction:


Object - The transaction object to send:
* from: String - The address for the sending account. Uses the web3.eth.defaultAccount property, if not specified.
* to: String - (optional) The destination address of the message, left undefined for a contract-creation transaction.
* value: Number|String|BigNumber - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction.
* gas: Number|String|BigNumber - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded).
* gasPrice: Number|String|BigNumber - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price.
* data: String - (optional) Either a byte string containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code.
* nonce: Number - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.

To work out what data to send, check out the step-by-step example under the heading Use Your Contract Using curl And JSON-RPC in How to call a contract method using the eth_call JSON-RPC API, search for "ABI" on this site, and check out Ethereum Contract ABI.

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.