I have a contract code which have getter and setter method.
I have written a java main class which done followings
TransactionReceipt receipt = sendTxAndWait(new byte[0], Hex.decode(metadata.bin));
byte[] contractAddress = receipt.getTransaction().getContractAddress();
CallTransaction.Contract contract = new CallTransaction.Contract(metadata.abi);
CallTransaction.Function inc = contract.getByName("set");
byte[] functionCallBytes = inc.encode(123);
TransactionReceipt receipt1 = sendTxAndWait(contractAddress, functionCallBytes);
Another class having below:
TransactionReceipt receipt = sendTxAndWait(new byte[0], Hex.decode(metadata.bin));
byte[] contractAddress = receipt.getTransaction().getContractAddress();
CallTransaction.Contract contract = new CallTransaction.Contract(metadata.abi);
ProgramResult r = ethereum.callConstantFunction(Hex.toHexString(contractAddress), contract.getByName("get"));
Object[] ret = contract.getByName("get").decodeResult(r.getHReturn());
System.out.println("Current contract data member value: " + ret[0]);
ProgramResult r1 = ethereum.callConstantFunction("823555f52655029e4269ccc8de2bf5d5b83936a8", contract.getByName("get"));
Object[] ret1 = contract.getByName("get").decodeResult(r1.getHReturn());
System.out.println("Executed contract data member value: " + ret1[0]);**
These two are running in two different JVM. now running second program give me output like below: Current contract data member value: 0 Executed contract data member value: 123
Now this "823555f52655029e4269ccc8de2bf5d5b83936a8" is the contract address resolved while creating contract by first java class.
So is it like that, every node want to access a contract member value should know the contract address. or is there any other way to access contract member value in ethereumj client?