Deploying a contract
First we need a contract to deploy. We can use the well-knownStorage.sol
contract written in Solidity. The following Solidity code can be copied and pasted into a text editor and saved as parallax/storage-contract/Storage.sol
.
solc
) to be installed on the local machine. Then, compile and save the ABI and bytecode to a new build
subdirectory using the following terminal commands:
./prlx attach prlx.ipc
.
Now, for convenice we can store the abi and bytecode in variables in the console:
eth.sendTransaction
, passing the contract bytecode in the data
field. For convenience we can create a transaction JSON object first, then pass it to eth.sendTransaction
later. Let’s use the first account in eth.accounts
as the sender. The amount of gas to include can be determined using eth.estimateGas
:
new()
method which deploys the contract.
deployed_contract
):
eth.getTransaction()
returns the deployment transaction details including the contract bytecode in the input
field. To interact with the contract, create an instance by passing the deployment address to contract.at
then call the methods.