Serve Your Own CosmicLink Front-End

Mister Ticot
Dec 20, 2019 · 5 min read
Photo by Clark Tibbs

What makes CosmicLink different from most Stellar-related services is that it is an open solution. In other words, instead of jailing users for growth & profit, it gives the keys to everyone. Let’s dig together into one of the greatest feature of such an open system: forks.

Why?

CosmicLinks offers applications to send transaction requests to user wallets, where the transaction can get signed without compromising private keys. The flow is as follows:

User wallet is known:

User wallet is not known:

Problems:

Solution:

Providing an easy way for anyone to host their own CosmicLink front-end.

Cosmic.link has been designed in such a way that this can be achieved in a few clicks − at no cost − by whoever own a GitHub account. Yeah!

Who?

This solution is mainly intended for services that have many users regularly signing transactions, and that need to enforce the highest security standards. Serving your own front-end induce additional friction: Cosmic.link users already set up their public keys & wallets of choice, but will have to do so again when using a front-end served from another domain.

If you expect your users to use the signing interface dozens of times on average, then it may be for you. If you expect them to use it only once or a few times, or if you don’t intend to audit code updates, you better stick with Cosmic.link.

In any case, you are welcome to try the forking process as it is easy, fast and educational. :)

How?

Step 1 − Fork from the parent repository

Step 2 − Serve your fork on GitHub pages

Step 3 − Test your fork

2. Go to the copy/pasted address. (https://${username}.github.io/https-cosmic-link)

Step 4 − Link it with your domain

You can link this page with a domain of yours. The instruction bellow works for domain providers supporting CNAME records. If you need a more generic explanation, please see GitHub instructions.

The example fork I created while writing this article is available at tifa.cosmic.plus (and will not get updated).

Step 5 − Update your fork

This part is slightly more technical. GitHub doesn’t provide a way to do it, so we’ll go for some command line.

Setup:

# Clone your repository.
git clone https://github.com/${username}/https-cosmic-link
cd https-cosmic-link
# Add parent remote.
git remote add parent https://git.cosmic.plus/https-cosmic-link

Update:

# Pull new commits.
git pull parent master
# Merge new commits.
git merge parent/master
# Push updates to your repository.
git push --follow-tags

Extras

More Testing

Federated Server

Setup your federated domain by editing the .well_known/stellar.toml file of your forked repository. Cloudflare users can use this minimalist federated server implementation.

Custom Stylesheet

Going Further

The point of this article was to explain how to fork https-cosmic-link, which is the repository from which Cosmic.link is served.

Forkers who want to edit the sources, or to audit updates before serving, have to fork the source repository & build the served repository on their own.

While this is possible to do right now (as of Dec 2019), those sources, as well as the related documentation, are about to get rewritten & the whole code base will be made easier to deal with. I’d advise waiting for Cosmic.link v2 before going through that task.

And yes… this is an announcement. ;)

Cosmic.plus

Applications & developer resources for Stellar

Mister Ticot

Written by

Free software and permaculture enthusiast

Cosmic.plus

Applications & developer resources for Stellar

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade