These are chat archives for Nethereum/Nethereum

15th
Sep 2017
ChinhP
@Chinh-P
Sep 15 2017 03:22

hi, I got another Error when switch from local (testrpc) to Azure blockchain at line
var unlockAcc = await web3.Personal.UnlockAccount.SendRequestAsync(senderAddress, "myPassWord", 120);
The error is:

Test method UnitTest.TestNethereumMyCoin.InitialAccountWithMyCoinInAzure threw exception: 
Nethereum.JsonRpc.Client.RpcResponseException: The method personal_unlockAccount does not exist/is not available
    at Nethereum.JsonRpc.Client.RpcClient.HandleRpcError(RpcResponse response)
   at Nethereum.JsonRpc.Client.RpcClient.<SendInnerRequestAync>d__2`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Nethereum.JsonRpc.Client.ClientBase.<SendRequestAsync>d__4`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at UnitTest.TestNethereumMyCoin.<InitialAccountWithMyCoinInAzure>d__3.MoveNext() in O:\RFR_2015\EHub-NewFeatures\Reza-Branch\UnitTest\TestNethereumMyCoin.cs:line 88
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

Because using web3.personal.unlockAccount method in truffle to unlock account from there also face the same error, So, It looks like the error comes from my Node in azure not yet enable personal rpcapi
I was about to find a way to enable personal rpcapi, but then, I read some comments about security when enable it. My 'manual way' to unlock account currently is run the ssh script provided by azure
ssh -p 3000 gethadmin@fbcpag5uo.southeastasia.cloudapp.azure.com
then run geth attach and using personal.unlockAccount function
That was my long story, and my short answer is: is there any way to programmatically unlock account using ssh or do I still need to enable personal rpcapi

Nonnull
@windseason
Sep 15 2017 03:25
hello, I want to know if I can integrate this library into an existing ios/anroid project which base on native code(objective-c/java)
kai
@kaista82_twitter
Sep 15 2017 07:14
Chinh, have you enable that on the daemon rpcapi command line?
ChinhP
@Chinh-P
Sep 15 2017 07:18
which one Kai, in order to solve the error, I did enable the rpcapi using geth
so, there is no error now
I just wonder, Is it ok if we enable it
or should we use shh (which I currently manually use)
kai
@kaista82_twitter
Sep 15 2017 07:36
Shh for what? If you enable it make sure the firewall blocks it if you are worried maybe change the port too
ChinhP
@Chinh-P
Sep 15 2017 07:37
because Im using Azure BlockChain
so, basically Im not control the PC
in order to update something, I use SSH-TO-FIRST-TX-NODE, something like ssh -p 3000 gethadmin@fbcpag5uo.southeastasia.cloudapp.azure.com
when I connect using shh then geth attach, all modules available
ChinhP
@Chinh-P
Sep 15 2017 07:42
{
admin: "1.0",
debug: "1.0",
eth: "1.0",
miner: "1.0",
net: "1.0",
personal: "1.0",
rpc: "1.0",
txpool: "1.0",
web3: "1.0"
}
but thank for the suggestion, I will check that direction
kai
@kaista82_twitter
Sep 15 2017 07:53
Oh ssh not shh
Thats because you are local command line which has everything open
Doesnt mean the rpc server is allowing calls
ChinhP
@Chinh-P
Sep 15 2017 07:54
yes, correct
kai
@kaista82_twitter
Sep 15 2017 07:56
You may need to instantiate the web3 instance passing the account unless using managed then you woukd have to copy the keystore to the server
ChinhP
@Chinh-P
Sep 15 2017 07:56
when using get attach myserver url, only 4 modules remain
{
eth: "1.0",
miner: "1.0",
net: "1.0",
rpc: "1.0",
}
You may need to instantiate the web3 instance passing the account unless using managed then you woukd have to copy the keystore to the server
By doing so, do I still need to enable personal rpcapi?
because I know for sure that if I enable personal rpcapi, then, the error Nethereum.JsonRpc.Client.RpcResponseException: The method personal_unlockAccount does not exist/is not available will disappear, I tried it already
kai
@kaista82_twitter
Sep 15 2017 08:02
Yes you will always need to do that for managed but you dont have to use managed, what functions do you need? Transfer? Contracts?
Both of those you can sign offline
ChinhP
@Chinh-P
Sep 15 2017 08:08
Ic, Thanks. So Maybe I just let it enable for now, I'll check more about security later.
kai
@kaista82_twitter
Sep 15 2017 08:12
Enjoy!