Closed JerryZhao1988 closed 6 years ago
In 7 node example, the first node was unlocked at start to make the examples simple. For security reasons, we should not leave the nodes unlocked. You should programatically unlock the account using web3 or web3J. Please refer to https://web3j.readthedocs.io/en/latest/transactions.html.
Admin web3j = Admin.build(new HttpService());
web3j.personalSendTransaction(transaction, passphrase);
or
Admin web3j = Admin.build(new HttpService());
PersonalUnlockAccount personalUnlockAccount = web3j.personalUnlockAccount("0x000...", "a password").send();
if (personalUnlockAccount.accountUnlocked()) {
// send a transaction
}
If you autogenerate client from ABI using Web3j ,
Web3j web3 = Web3j.build(new HttpService()); // defaults to http://localhost:8545/
Credentials credentials = WalletUtils.loadCredentials("password", "/path/to/walletfile");
YourSmartContract contract = YourSmartContract.load(
"0x<address>|<ensName>", <web3j>, <credentials>, GAS_PRICE, GAS_LIMIT);
TransactionReceipt transactionReceipt = contract.someMethod(
<param1>,
...).send();
Note: Quorum Maker creates nodes with empty password now. We are working on a change to allow user to create non empty passwords and manage them from QM. For time being use empty string as password.
I am doing some test on the new version 2.1 using java web3j-quorum. I found that the account is not unlocked automatically, so I can not deploy or doing some transaction on it directly.
So what I am doing is that I modified start_quorum_template.sh adding unlock option and delete the raft option in the end
Then add a empty file under qdata folder.
Can you guys take this suggestion, then it would be easier for other guys to deploy smart contract.