I tried...
screen -S cli_wallet cli_wallet --chain-id 0f8b631d7a9dfebf16d6776fab96b629a14429762bf9c3eb95db1e4e4af637a4 -H 127.0.0.1:8092
echo -e "password\n"
but it did not work.
expect is used for this, here is an example
#!/usr/bin/expect -f
set chain_id "0f8b631d7a9dfebf16d6776fab96b629a14429762bf9c3eb95db1e4e4af637a4"
set wallet "test_wallet"
set rpc_user "alt"
set rpc_password "alt"
set port "8092"
set unlock_password "thisismypassword"
spawn ./cli_wallet -w $wallet --chain-id $chain_id -H 127.0.0.1:$port -u $rpc_user -p $rpc_password
expect -exact "locked >>> "
send -- "info\r"
expect -exact "locked >>> "
send -- "unlock $unlock_password\r"
expect -exact "unlocked >>> "
send -- "list_my_accounts\r"
interact
wait
Quote from: alt on September 28, 2015, 04:46:19 AM
expect is used for this, here is an example
#!/usr/bin/expect -f
set chain_id "0f8b631d7a9dfebf16d6776fab96b629a14429762bf9c3eb95db1e4e4af637a4"
set wallet "test_wallet"
set rpc_user "alt"
set rpc_password "alt"
set port "8092"
set unlock_password "thisismypassword"
spawn ./cli_wallet -w $wallet --chain-id $chain_id -H 127.0.0.1:$port -u $rpc_user -p $rpc_password
expect -exact "locked >>> "
send -- "info\r"
expect -exact "locked >>> "
send -- "unlock $unlock_password\r"
expect -exact "unlocked >>> "
send -- "list_my_accounts\r"
interact
wait
Thanks!
When listening to 8092 like this:
./programs/cli_wallet/cli_wallet -H 127.0.0.1:8092
you can also just use curl:
curl --data '{"jsonrpc": "2.0", "method": "call", "params": [0,"unlock",["PASSWORD"]], "id": 0