aragonzkresearch / tlcs-chain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TLCS

This repo contains node software for running a Blockchain which provides a Time Lock Cryptography Service.

NOTE: This is a WIP, e.g. it is still undergoing heavy development and should not be used in production!

How to run

Getting Started

TLCS uses the tendermint-abci crate to communicate with a Tendermint instance which runs as a separate process. This means that to run a full node, Tendermint must be installed and run separately (see instructions below).

Requirements

Rust compiler

The minimum supported Rust version is 1.67.1. Follow the installation instructions.

Tendermint

To install Tendermint, clone the Tendermint repo checkout v0.34.21 then follow the installation instructions.

libclang

This is needed by the rocks db crate, run sudo apt install libclang-dev build-essential.

Running a local chain

  1. Clone this repo:
git clone https://github.com/aragonzkresearch/tlcs-chain
cd tlcs-chain
  1. Initialize a new chain and add accounts:
make init
tlcs add-genesis-account cosmos1syavy2npfyt9tcncdtsdzf7kny9lh777pahuux 53uatom
tlcs add-genesis-account cosmos1skgmlw2j4qupafzcg5qvacd76mfzfe69la0hxz 53uatom
tlcs add-genesis-account cosmos1gc308w6mg7skucsdxdjehhewr4aetwq24zf92m 50uatom
tlcs add-genesis-account cosmos1jf9e50e6w5wdlgdxnf6s6rh4n0ed4z86hzh6em 50uatom
  1. Build and start the application:
make run

The application will listen for connections on tcp://127.0.0.1:26658.

  1. From a different terminal window start Tendermint:
make tendermint-start

Tendermint will connect to the application and bind it's RPC server to 127.0.0.1:26657.

The chain (consisting of one node) is now up and running.

Querying the chain

So far we've been running tlcs indirectly using make commnds and the rust build tool, Cargo. In the next section we'll install tlcs and use it to query the chain (just like cosmos-sdk chains the tlcs binary serves as a node and client).

  1. Install tlcs:
make install
  1. Query a balance:
tlcs query bank balances cosmos1syavy2npfyt9tcncdtsdzf7kny9lh777pahuux

Which returns:

{
  "balances": [
    {
      "denom": "uatom",
      "amount": "53"
    }
  ],
  "pagination": null
}

The balance of this address was set to 53 in the genesis file.

  1. Import the key corresponding to the above address into the tlcs key store:
echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | tlcs keys add kevin --recover
echo "all victory hero talent forget twice quote you office vacant sleep kangaroo disorder scorpion humble gorilla coast pudding edge garlic bid dutch excuse magic" | tlcs keys add alice --recover
echo "quick rack fancy cruel knee early summer clock group apology excuse file voice album fold cave garbage student awake twenty stereo argue draw human" | tlcs keys add ahmad --recover
echo "cool snack excite whale maximum rally fly swap link detect shy rich subway early again analyst pet have powder notice exhaust drill donor cream" | tlcs keys add loesender --recover
  1. Send tokens:
tlcs tx kevin bank send cosmos180tr8wmsk8ugt32yynj8efqwg3yglmpwp22rut 10uatom --fee 1uatom
  1. Query the address balance and observe that it has decreased by 11uatom which is the sum of the amount transferred and the fee:
tlcs query bank balances cosmos1syavy2npfyt9tcncdtsdzf7kny9lh777pahuux

Which returns:

{
  "balances": [
    {
      "denom": "uatom",
      "amount": "53"
    }
  ],
  "pagination": null
}
  1. Submit keypair request and contribute data
tlcs tx kevin timelock keypair 100 1 1692800327 

Get keypair ID

tlcs query timelock keypairs-by-round 100
tlcs query timelock contributions-by-round 100
tlcs tx tlcs contribute alice 100 1 0
tlcs tx tlcs contribute ahmad 100 1 0
tlcs query timelock contributions_by_round 100

Production server node

  1. Clone this repo:
git clone https://github.com/aragonzkresearch/tlcs-chain/
make build
  1. Initialize a new chain and add accounts:
tlcs init
  1. Build and start the application:
tlcs run

About


Languages

Language:Rust 96.9%Language:Shell 2.6%Language:Makefile 0.5%