Can I automatically run and unlock Graphene cli_wallet using .sh?

Started by clayop, September 28, 2015, 12:48:53 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xeroc

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

clayop

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!
Bitshares Korea - [url="http://www.bitshares.kr"]http://www.bitshares.kr[/url]
Vote for me and see Korean Bitshares community grows
delegate-clayop

alt

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

clayop

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.
Bitshares Korea - [url="http://www.bitshares.kr"]http://www.bitshares.kr[/url]
Vote for me and see Korean Bitshares community grows
delegate-clayop