[Ethereum] How should I enable the api’s ‘personal’ and ‘admin’ over RPC on Azure ‘Ethereum Consortium Blockchain’

json-rpcrpc

How should I enable the api’s ‘personal’ and ‘admin’ over RPC on Azure ‘Ethereum Consortium Blockchain’. Is there any way by which we get direct access to the VM console (Now we SSH on to the VM to connect)

Platform – Ethereum Consortium Blockchain on Azure
We have setup ‘Ethereum Consortium Blockchain’ with 3 transaction nodes and 4 mining nodes (2 subnets – 2 nodes each) on Azure. By default ‘eth’,’net’ and ‘web3’ api’s are available over the RPC. We need the api’s ‘personal’ and ‘admin’ as well be available. I have tried to stop RPC and then start RPC with the parameters for required api’s included. But that doesn’t work.

In our on-premises Ethererum environment, we do have direct access to the VM and ‘geth’ console. So we can initialize ‘geth’ so as to open all the required api’s over RPC (which I am not able to do on Azure)

Thank you,
Anjana

Best Answer

Below steps is what you need to do:
1. Open the SSH console for transaction node by running ETHEREUM-RPC-ENDPOINT Ssh script on powerShell. You can find the script on Azure portal, sthing like

ssh -p 3000 gethadmin@yourVM.southeastasia.cloudapp.azure.com

2. Edit the file start-private-blockchain.sh. In order to edit this file, or you use VIM editor (VIM start-private-blockchain.sh) or using some Editors over ssh (Example: WinSPC)

3. Find below lines and update
From

   nohup geth --datadir $GETH_HOME -verbosity $VERBOSITY $BOOTNODE_URLS --maxpeers $MAX_PEERS --nat none --networkid $NETWORK_ID --identity $IDENTITY $MINE_OPTIONS $FAST_SYNC --rpc --rpcaddr "$IPADDR" --rpccorsdomain "*" >> $GETH_LOG_FILE_PATH 2>&1 &


To

nohup geth --datadir $GETH_HOME -verbosity $VERBOSITY $BOOTNODE_URLS --maxpeers $MAX_PEERS --nat none --networkid $NETWORK_ID --identity $IDENTITY $MINE_OPTIONS $FAST_SYNC --rpc --rpcaddr "$IPADDR" --rpccorsdomain "*" --rpcapi "eth,net,web3,admin,personal" >> $GETH_LOG_FILE_PATH 2>&1 &

The difference is adding --rpcapi "eth,net,web3,admin,personal"

4. Restart the tx VM using azure portal.

Now you have admin, personal rpcapi enable.

Note: There are some security threats after enabling those rpcapis.

Reference:
https://blogs.msdn.microsoft.com/pkirchner/2017/07/12/getting-started-with-ethereum-tutorials-on-azure/
https://medium.com/@gilangbhagaskara/smart-contract-in-azure-ethereum-consortium-part-i-901951116bfc
https://social.msdn.microsoft.com/Forums/en-US/9fd92236-2354-4788-a86b-b716d232f630/unlock-account-using-code-not-working?forum=azureblockchain&prof=required

Related Topic