github.com/franono/tendermint@v0.32.2-0.20200527150959-749313264ce9/tools/mintnet-kubernetes/examples/basecoin/lightclient.md (about)

     1  **OUTDATED**
     2  
     3  # Using with lightclient
     4  
     5  We have an awesome cluster running, let's try to test this out without
     6  relying on executing commands on the cluster.  Rather, we can connect to the
     7  rpc interface with the `light-client` package and execute commands locally,
     8  or even proxy our webapp to the kubernetes backend.
     9  
    10  ## Setup
    11  
    12  In order to get this working, we need to know a few pieces of info,
    13  the chain id of tendermint, the chain id of basecoin, and an account
    14  with a bit of cash....
    15  
    16  ### Tendermint Chain ID
    17  
    18  `kubectl exec -c tm tm-0 -- curl -s http://tm-1.basecoin:26657/status | json_pp | grep network`
    19  
    20  set TM_CHAIN with the value there
    21  
    22  ### Basecoin Chain ID
    23  
    24  `kubectl exec -c app tm-1 -- grep -A1 chainID /app/genesis.json`
    25  
    26  set BC_CHAIN with the value there
    27  
    28  ### Expose tendermint rpc
    29  
    30  We need to be able to reach the tendermint rpc interface from our shell.
    31  
    32  `kubectl port-forward tm-0 26657:26657`
    33  
    34  ### Start basecoin-proxy
    35  
    36  Using this info, let's connect our proxy and get going
    37  
    38  `proxy-basecoin -tmchain=$TM_CHAIN -chain=$BC_CHAIN -rpc=localhost:26657`
    39  
    40  ## Basecoin accounts
    41  
    42  Well, we can connect, but we don't have a registered account yet...
    43  Let's look around, then use the cli to send some money from one of
    44  the validators to our client's address so we can play.
    45  
    46  **TODO** we can add some of our known accounts (from `/keys`) into
    47  the genesis file, so we can skip all the kubectl money fiddling here.
    48  We will want to start with money on some known non-validators.
    49  
    50  ### Getting validator info (kubectl)
    51  
    52  The basecoin app deployment starts with 1000 "blank" coin in an account of
    53  each validator.  Let's get the address of the first validator
    54  
    55  `kubectl exec -c app tm-1 -- grep address /app/key.json`
    56  
    57  Store this info as VAL1_ADDR
    58  
    59  ### Querying state (proxy)
    60  
    61  The proxy can read any public info via the tendermint rpc, so let's check
    62  out this account.
    63  
    64  `curl localhost:8108/query/account/$VAL1_ADDR`
    65  
    66  Now, let's make out own account....
    67  
    68  `curl -XPOST http://localhost:8108/keys/ -d '{"name": "k8demo", "passphrase": "1234567890"}'`
    69  
    70  (or pick your own user and password).  Remember the address you get here.  You can
    71  always find it out later by calling:
    72  
    73  `curl http://localhost:8108/keys/k8demo`
    74  
    75  and store it in DEMO_ADDR, which is empty at first
    76  
    77  `curl localhost:8108/query/account/$DEMO_ADDR`
    78  
    79  
    80  ### "Stealing" validator cash (kubectl)
    81  
    82  Run one command, that will be signed, now we have money
    83  
    84  `kubectl exec -c app tm-0 -- basecoin tx send --to <k8demo-address> --amount 500`
    85  
    86  ### Using our money
    87  
    88  Returning to our remote shell, we have a remote account with some money.
    89  Let's see that.
    90  
    91  `curl localhost:8108/query/account/$DEMO_ADDR`
    92  
    93  Cool.  Now we need to send it to a second account.
    94  
    95  `curl -XPOST http://localhost:8108/keys/ -d '{"name": "buddy", "passphrase": "1234567890"}'`
    96  
    97  and store the resulting address in BUDDY_ADDR
    98  
    99  **TODO** finish this
   100