This is a web server that works as middleware between the Kima Transaction Widget and Kima Chain. Once it receives a transaction request from the widget, it will submit a transaction to Kima Chain signed by a local wallet.
The server is an Express application and requires minimal setup. Here are the instructions:
We recommend Keplr, which is a widely used wallet for blockchains within the Cosmos ecosystem.
Install it from here and make sure you back it up by saving the seed phrase.
You will need to record the mnemonic seed phrase rather than the private key, as the seed phrase is used as an environment variable.
If you are developing on the KIMA testnet, you can acquire test KIMA tokens from our faucet site.
Follow the instructions here if you have not used a faucet before.
https://github.com/kima-finance/kima-transaction-backend
If you are using Docker, you can add these to the docker-compose
; otherwise, create an .env file with the following key pairs:
Copy
A few notes about these environment variables:
KIMA_BACKEND_MNEMONIC
is the seed phrase from the wallet you installed.
KIMA_BACKEND_SECRET
is the secret for generating JSON Web Tokens. Read more about JWT here if you have not used them before.
For checking whether transactions involve risky wallets. you will need an xplorisk account. The Xplorisk Lambda endpoint should be added to your .env file as XPLORISK_URL
.
Neither of these dependencies are mandatory as long as you do not want to invoke the /compliant
endpoint.
You can run:
npm i
then
npm run dev
but the easiest way to get up and running without any dependency issues is with Docker. Use docker-compose.yml for dev, docker-compose-prod.yml for prod.
Start the server with:
docker compose up
In your terminal, run the following command:
Copy
The server should respond with a valid authtoken with a five-second expiry.
The Kima Transaction Widget sends a POST request to this endpoint before it submits a transaction request. Returns JWT as cookie which has 5 seconds of life time. This cookie will be expired after 5 seconds. Kima Transaction Widget will call the second endpoint right after it receives JWT Auth Token.
This is a POST request that submits a cross-chain transaction using the developer wallet whose details are stored. Before the /submit
endpoint is called, the JWT will first be validated.
The reponse object will contain a transaction ID which can be used to track the success of the submission.
An example of the request body that should be sent:
Copy
This is a GET request which will return OK if the address is compliant. Note that this will work only if you have a Xplorisk account.
Copy