Suppose that you have an online web site, social network, or game. Your users connect with your server(s) using a mobile, web or desktop client application. Each user has a nickname, and should provide credentials to initiate a session with your server.

Now, you want to give them tokens, as they complete tasks, activities, games, receive likes, or provide content to your system. That tokens resides in an Ethereum-like blockchain. I want to describe a workflow that allow your users to participate in the blockchain.

Blockchain Sign Up

A user must sign up to participate in the blockchain activities. He/she has a nickname, and presents credentials to sign into the server application. But I’m talking about OTHER process: to assign a blockchain account to the user, he/she must register with a new and private credential, unknown to the server application:

User Sign Up to Blockchain
  1. The user fill the blockchain sign up form, given new and private credentials (ie a new password)
  2. Given the user nickname and the new credentials, the client applications calculates a blockchain address. It could use the nickname and new credentials to generate the “twelve words” needed to generate an account.
  3. The client application sends the account information (its address) to the server application.
  4. The server application associates the user nickname with the new blockchain address, using a public registry smart contract. Maybe it sends the first tokens to the user blockchain account.
  5. The client application could check the availability of tokens associated to user blockchain account address

Blockchain Sign In

No private key or “twelve words” are saved in the client side. If the user needs to initiate a blockchain session again, then:

Initiates the Session
  1. The user provides the blockchain credentials (ie private password)
  2. The client application, given the user nickname and provided private credential, generates the account information (private key, address).
  3. The client application verifies that the address generated is associated with user nickname querying the public registry smart contract

Crypto Gas for the User

Usually, the user don’t send transactions to the blockchain. He/she considers the tokens as a points program. But if he/she is interested in operate in the blockchain, crypto ether is needed to pay gas cost, then:

Exchange Tokens with Crypto
  1. The user informs to the client application his/her intention to exchange N tokens by gas
  2. The client application, using the in-memory private key, builds and signs a user transaction, that transfer some tokens to the server account
  3. The server application do:
    a) Checks if the user has at least N tokens
    b) Funds the user account with enough gas to execute the tokens transfer transaction
    c) If the transaction is executed succesfully, then the server application transfer gas/crypto to the user account

If the total fund were transferred in point b, then the user could use those funds to execute an ALTERNATIVE transaction, that competes with the token transfer transaction provided.

There are many points to discuss, and some improvements. Instead of associate a user nickname with an address, the client application could provide a JSON string with a keystore information (see What is an Ethereum keystore file?).

Angel “Java” Lopez

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store