---
# System prepended metadata

title: Interblockchain Transaction using Starport

---

Interblockchain Transaction using Starport
===

### Set up Starport

`git clone https://github.com/tendermint/starport && cd starport && make`

Then move Starport binaries to $PATH or add the binary directory to environment variable. Make sure the $GOPATH is correctly set. Most problems are solved with a fresh install or checking if the variables are set right. Also ensure your Golang is at the most updated stable version. Currently I used Go1.15.8 with Starport v0.13.2-52-g7f8bd92.

Adding the following to `.bashrc` solved most problems I had.

```
export GO_PATH=~/go
export PATH=$PATH:/$GO_PATH/bin
export PATH=$PATH:$(go env GOPATH)/bin
```



### Install Relayer

Relayer is a package used to relay packets between IBC compatible chains. You might have to build it locally for Stargate update. Please make sure you relayer versions match with Starport's requirements.

`git clone https://github.com/cosmos/relayer && make install`

### (Optional) Use the Web IDE with preinstalled binaries

If you're building a Proof-of-Concept, you might want to use the [Gitpod Environment](https://gitpod.io/#https://github.com/tendermint/starport/). Starport and Relayer come installed in this environment. 

### Initiate two Stargate versioned chains

```bash
starport app github.com/bar/bar --sdk-version stargate
cd bar
starport serve
```

You should see a `🌠 relayer info` in the terminal output for foo. Copy this somewhere, we will be needing it to link foo and bar. For me, it was `eyJDaGFpbklEIjoiYmFyIiwiTW5lbW9uaWMiOiJyZXNwb25zZSBub21pbmVlIGVtZXJnZSB0YW5rIGNodXJuIGhvdmVyIGJhdHRsZSBhbmtsZSBjaGlja2VuIHRvbmlnaHQgYnVzeSBtZWRhbCBlY2hvIGVsYm93IG1lYXN1cmUgZGlzY292ZXIgc3dhcCByYXpvciBkdW1iIHN3YXAgc2VsZWN0IGJ1ZGR5IHdpbnRlciBob3Jyb3IiLCJSUENBZGRyZXNzIjoiaHR0cHM6Ly8yNjY1Ny1wbHVtLWJhdC01YmxzbGFzOS53cy11czAzLmdpdHBvZC5pbzo0NDMifQ`

In another directory and terminal tab, run

```bash
starport app github.com/foo/foo --sdk-version stargate
cd foo
starport serve
```

### Add the Chains together

Once you have the two chains running, open two more terminal windows. 

Now do the following.

```
cd foo 
starport chain add eyJDaGFpbklEIjoiYmFyIiwiTW5lbW9uaWMiOiJyZXNwb25zZSBub21pbmVlIGVtZXJnZSB0YW5rIGNodXJuIGhvdmVyIGJhdHRsZSBhbmtsZSBjaGlja2VuIHRvbmlnaHQgYnVzeSBtZWRhbCBlY2hvIGVsYm93IG1lYXN1cmUgZGlzY292ZXIgc3dhcCByYXpvciBkdW1iIHN3YXAgc2VsZWN0IGJ1ZGR5IHdpbnRlciBob3Jyb3IiLCJSUENBZGRyZXNzIjoiaHR0cHM6Ly8yNjY1Ny1wbHVtLWJhdC01YmxzbGFzOS53cy11czAzLmdpdHBvZC5pbzo0NDMifQ
```

Replace the string with the string on your screen. 

### Transact from Foo to Bar

First we need the address of the chain Foo and use that to check the balance of tokens on the Chain.

```
cd foo
food q bank balances $(rly chains address foo)
```

We get something like this

```
balances:
- amount: "800"
  denom: token
pagination:
  next_key: null
  total: "0"
```

We have about 800 of the token, we can play around with this in `secret.yml`.

With that in mind, let's commit an interblockchain transaction!

```
rly tx transfer foo bar 2tokens $(rly chains address bar)
rly tx relay foo-bar
```

### Check that the transaction has been committed

```
bard q bank balances $(bard keys show bar -a --keyring-backend test)
```

When we check the balances, we can see that we have 2 tokens of the denom `ibc/F45CC9774FF2C21CD8F2C6DC850D05E45B5B83325C93388233AFC2446F96F16A` and 800 of the denom `token`.