Closed matrixoneken closed 5 years ago
My command about geth as following geth --datadir new-node-1 --nodiscover --istanbul.blockperiod 5 --syncmode full --mine --minerthreads 1 --verbosity 5 --networkid 10 --rpc --rpcaddr 0.0.0.0 --rpcport 22000 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,istanbul--emitcheckpoints --port 30303
geth --datadir new-node-2 --nodiscover --istanbul.blockperiod 5 --syncmode full --mine --minerthreads 1 --verbosity 5 --networkid 10 --rpc --rpcaddr 0.0.0.0 --rpcport 22001 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,istanbul--emitcheckpoints --port 30304
geth --datadir new-node-3 --nodiscover --istanbul.blockperiod 5 --syncmode full --mine --minerthreads 1 --verbosity 5 --networkid 10 --rpc --rpcaddr 0.0.0.0 --rpcport 22002 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,istanbul--emitcheckpoints --port 30305
geth --datadir new-node-4 --nodiscover --istanbul.blockperiod 5 --syncmode full --mine --minerthreads 1 --verbosity 5 --networkid 10 --rpc --rpcaddr 0.0.0.0 --rpcport 22003 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,istanbul--emitcheckpoints --port 30306
geth --datadir new-node-5 --nodiscover --istanbul.blockperiod 5 --syncmode full --mine --minerthreads 1 --verbosity 5 --networkid 10 --rpc --rpcaddr 0.0.0.0 --rpcport 22004 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,istanbul--emitcheckpoints --port 30307
Are you using the account created at step 6?
Generate one or more accounts for this node using geth --datadir new-node-1 account new and take down the account address. A funded account may be required depending what you are trying to accomplish
You will probably need to unlock the account first, using the password that was given when you created the account. See https://web3js.readthedocs.io/en/1.0/web3-eth-personal.html#unlockaccount for how to do this via web3js
@matrixoneken as @prd-fox mentions, there are 2 ways to address this issue. The one described by Peter is the prefered one, but you may alternatively add cli options to your geth that would auto-unlock account(s), please see https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options and search for unlock
option.
All of the above requires you to have had created at least one ethereum account.
https://github.com/jpmorganchase/quorum/issues/612
I have open 5 nodes following https://github.com/jpmorganchase/quorum/wiki/From-Scratch#quorum-with-istanbul-bft-consensus But when I deployed a smart contract with web3.js. I got an error about 'authentication needed: password or unlock'
My web3.js code as following:
var Web3 = require("web3"); var web3 = new Web3(); web3.setProvider(new Web3.providers.HttpProvider("http://192.168.193.37:22000")); var v = web3.version;
var mainAbi=[{"constant":false,"inputs":[{"name":"strVal","type":"string"}],"name":"Set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"Get","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"holdings","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"strVal","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]; var mainBytecode ="0x608060405234801561001057600080fd5b50604051610514380380610514833981018060405281019080805182019291905050508060009080519060200190610049929190610050565b50506100f5565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009157805160ff19168380011785556100bf565b828001600101855582156100bf579182015b828111156100be5782518255916020019190600101906100a3565b5b5090506100cc91906100d0565b5090565b6100f291905b808211156100ee5760008160009055506001016100d6565b5090565b90565b610410806101046000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806334541fcd1461005c578063b1976a02146100c5578063e79bf13b14610155575b600080fd5b34801561006857600080fd5b506100c3600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101e5565b005b3480156100d157600080fd5b506100da6101ff565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011a5780820151818401526020810190506100ff565b50505050905090810190601f1680156101475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016157600080fd5b5061016a6102a1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101aa57808201518184015260208101905061018f565b50505050905090810190601f1680156101d75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b80600090805190602001906101fb92919061033f565b5050565b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102975780601f1061026c57610100808354040283529160200191610297565b820191906000526020600020905b81548152906001019060200180831161027a57829003601f168201915b5050505050905090565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103375780601f1061030c57610100808354040283529160200191610337565b820191906000526020600020905b81548152906001019060200180831161031a57829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061038057805160ff19168380011785556103ae565b828001600101855582156103ae579182015b828111156103ad578251825591602001919060010190610392565b5b5090506103bb91906103bf565b5090565b6103e191905b808211156103dd5760008160009055506001016103c5565b5090565b905600a165627a7a723058204e0f342b1d9b9db66f0d458a7d24ac3a066a5919d1c5c3011f4453a5f78dfb6e0029"; var maincontractContract =new web3.eth.Contract(mainAbi);
web3.eth.getAccounts().then( function(fromaddress) {
maincontractContract .deploy({ data: mainBytecode, arguments: ["BTC-89,ETH-10000"] }) .send( { from: fromaddress[0], gas: '0x47b760', gasPrice: 0,
}, function (error, transactionHash) { console.log(transactionHash, error); } ) .on("error", function (error) { console.log("error:"); console.log(error); }) .on("transactionHash", function (transactionHash) { console.log("transactionHash:"); console.log(transactionHash); }) .on("receipt", function (receipt) { console.log("receipt:"); console.log("end time:"+new Date()); console.log(receipt.contractAddress); // contains the new contract address }) .then(function (newContractInstance) { console.log("address:"); console.log(newContractInstance.options.address); // instance with the new contract address }); });