Skip to content

staex-io/tc-linera-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TrustedChain Linera application

Usage

You can install and use Linera application on testnet and local network.

Testnet

make init_wallet_testnet
make request_chain_testnet

make build
# Deploy your application.
make publish # adce643b6ffff6c49e7775f327a2cfe7a5682d169df547c292ce4382bced529a

# Get your current chain (tags: DEFAULT).
linera wallet show # e2c1a391b6cfa3d714393d45b100a0bf6cbea85d0ddd989de586dc12d04333fb

make local_service

# Go to http://localhost:7070/chains/<chain_id>/applications/<application_id>
# Go to http://localhost:7070/chains/6e8a819845fd9bdb1173f33649f1dfc7b664f63748849a424cc721887ae0ab64/applications/2bb3ab9823ca30be4f55e09995f12be70958feec08b8b3e6472e250ae29c966d

Chains

1831ddbf2c768414ba34ff8f387771c9fad5df87a32e9024ad1dcb51f10b9e48
2b0525df9d8d3898430091eceb0a64007a0e718dfb8ebe73d2e83198123820b9
37c238b9b9b4c72e4ea304b22ca96563d6d73d0479166d441cd777c5dd49ad92
49c556f74d0fec156419e5f7161ca59ea5086fcb4094928652fd886630f2cac6
7d978c8eeaf1b6dd3aa326bcfc08e89dfff7ae5909d499692839a994056264ee
9dd48e2158e7c799927caea77fa010ffa16e98b4c310b08ea74581b39d218dce
c9fbec1fbb403b48b87256f567ba74e51171e1c89eedbbce3b7399221bb936d8
e3a48bf91a05dce8ce17749719a947dd0d6042e419543aaa9308be5cef32f333
f1b1d8868e03166b479b445d4ec75e820ab3bf6dbf7df001ea7b274c65a50061
ff87aba4a065002701308d4a8b8ae26c232170070c34e5428bdf0b1896a483f2

Local

  1. Remove already defined local keys and chains.
rm -rf /Users/lavr/Library/Application\ Support/linera

This is a default location on macOS.

  1. Run local Linera network.
make local_net
  1. Init local wallet.
make init_wallet_local
  1. Request local chain.
make request_chain_local
  1. Build your source code.
make build
  1. Publish your application.
make publish

Somewhere save application id.

  1. Start local Linera service.
make local_service
  1. Get your default local chain.
linera wallet show

Get first chain id and save it somewhere.

  1. You can use application using GraphQL API

Go to http://localhost:7070/chains/<chain_id>/applications/<application_id> and execute GraphQL queries.

GraphQL examples

Land data on-chain

mutation {
  land(
    id: "6a300ad5-15c5-4ac6-be27-b8a4d1d972ee"
    hash: "903b1c65f8ad53b2acf8704cf2ae766eae37eac0b5196321f34c3e07df3ecf30"
    signature: "2c546b2937ea6452c1f381d0c20077f02f63af72f77c1ed76edd4e220e2f59733fada263eab046c55d89a1ca8a6e3504d65eb4d6f40205c3cc7ac2c4603ffb04"
  )
}

Query data

{
  value(id: "6a300ad5-15c5-4ac6-be27-b8a4d1d972ee") {
    hash
    signature
  }
}

Linera service

To build image with Linera binary to start Linera service in the container, you need to prepare a folder with wallet info, then you can build the image.

cp -r /home/user/.config/linera linera-tmp
make build_linera_image