I have set up a private network with one node on Linux virtual machine and one is my local windows pc. I have done the peer adding. and I could see peer is added when I do a admin.peers on both the node. lets call two machines as machine A and machine B. I have created a contract which will store a number on machine A, here is the contract code (copied from internet) and deployment steps:
1) storeSrc
contract SimpleStorage {
uint storedData;
function set(uint x) {
storedData = x;
}
function get() constant returns (uint retVal) {
return storedData;
}
}
2) storeCompiled
web3.eth.compile.solidity(storeSrc)
3) storeContract
web3.eth.contract(storeCompiled.SimpleStorage.info.abiDefinition);
4) store
storeContract.new({
from:web3.eth.accounts[0],
data: storeCompiled.SimpleStorage.code,
gas: 300000},
function(e, contract){
if(!e) {
if(!contract.address) {
console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");
} else {
console.log("Contract mined! Address: " + contract.address);
console.log(contract);
}
}
}
})
With following steps I could easily deploy the contract on machine A and was able to execute its as well.
Now since I have machine B as an added peer ideally I should be able to access this contract with its address. But in order to access the contract function I have to do following steps:
1) storeSrc
contract SimpleStorage {
uint storedData;
function set(uint x) { storedData = x; }
function get() constant returns (uint retVal) { return storedData; }
}
2) storeCompiled
web3.eth.compile.solidity(storeSrc)
3)storeContract
web3.eth.contract(storeCompiled.SimpleStorage.info.abiDefinition);
4)store
storeContract.at("contract address")
So here are my questions:
Can I deploy this on a machine A without doing steps 1, 2, and 3?
Is there any way to avoid steps 1, 2, and 3 and directly access the contract using its address?