2.6 KiB
Getting Started
To start a REST server, we need to specify the following parameters:
Parameter | Type | Default | Required | Description |
---|---|---|---|---|
chain-id | string | null | true | chain id of the full node to connect |
node | URL | "tcp://localhost:46657" | true | address of the full node to connect |
laddr | URL | "tcp://localhost:1317" | true | address to run the rest server on |
trust-node | bool | "false" | true | Whether this LCD is connected to a trusted full node |
trust-store | DIRECTORY | "$HOME/.lcd" | false | directory for save checkpoints and validator sets |
Sample command:
gaiacli rest-server --chain-id=test \
--laddr=tcp://localhost:1317 \
--node tcp://localhost:46657 \
--trust-node=false
The server listens on HTTPS by default. You can set the SSL certificate to be used by the server with these additional flags:
gaiacli rest-server --chain-id=test \
--laddr=tcp://localhost:1317 \
--node tcp://localhost:46657 \
--trust-node=false \
--certfile=mycert.pem --keyfile=mykey.key
If no certificate/keyfile pair is supplied, a self-signed certificate will be generated and its fingerprint printed out.
Append --insecure
to the command line if you want to disable the secure layer and listen on an insecure HTTP port.
Gaia Light Use Cases
LCD could be very helpful for related service providers. For a wallet service provider, LCD could make transaction faster and more reliable in the following cases.
Create an account
First you need to get a new seed phrase :get-seed
After having new seed, you could generate a new account with it : keys
Transfer a token
The first step is to build an asset transfer transaction. Here we can post all necessary parameters to /create_transfer to get the unsigned transaction byte array. Refer to this link for detailed operation: build transaction
Then sign the returned transaction byte array with users' private key. Finally broadcast the signed transaction. Refer to this link for how to broadcast the signed transaction: broadcast transaction