Get Hands-On with Decentralized Relational Data – Atra Blockchain Services
Hey, it’s Hannah from Atra Blockchain Services. I’m going to give you a quick overview of one of our newer features, relational data tables. With our service, dTables, you can now quickly create relational data tables to power your decentralized application. For this tutorial, we are going to create a simple dApp that houses Members of an organization and allows them to post a message to the group.
Let’s get started!
You will find direct instructions in bold.
Metamask with test Ether is required to insert data at the end but not to build.
Start on your management console.
If you do not have an account, create one at console.atra.io — it will take less than a minute!
If you are not familiar with dTables, it is a service that allows you to create decentralized data tables with our point and click interface, and deploy them to the public Ethereum network.
We are going to build a simple application to showcase how to setup relational tables.
Head to dTables service dashboard
Here we are on the dTables dashboard home page.
Click Create Table
In this simple scenario, we are going to show you how to use relational data by connecting users for a Decentralized Organization dApp with their own messages from a feed, in sort of a ‘profile’ way.
For my first dTable, we’re going to create the members table.
Name your table OrgMembers, add description ‘a database of all org members’.
I’m going to store our member’s Name, UserName, Date Joined and WalletAddress.
Enter the following column names and type:
[Text] Name, [Text] UserName, [Date] DateJoined, [Address] WalletAddress.
Hit Create Table. This table isn’t using the new Pointer feature yet, but serves at the base for our application to be pointed to. You’ll see in the next step.
Back on the dTables dash, make sure your table deploys and is live (indicated by green lightning bolt).
Now that our users table is live, let’s create the next one that we will relate to it.
Click Create dTable.
Now we are going to create our message feed.
Type MessageFeed in the Name.
For our columns, we are going to store the Post and the PostDate. Now we will want to display the user who posted this. That’s where the pointer comes in — adding a pointer column to a dTable will allow you to pull a record from one table to another, thus creating relational data.
Let’s name our table and add the necessary columns.
Add columns [Text] Post and [Date] PostDate.
Add a pointer column to OrgMembers
Click Create dTable
Once live, let’s make Triggers to be able to insert posts our feed. Once we create the Triggers, we will wrap this up into a LiteUI and be done!
Head to your Triggers Dashboard and hit Create Trigger.
We are going to select Insert Record, as we are looking to insert posts into the feed.
Select MessageFeed as the dTable you want to modify.
For Post Text we will choose User Input.
For Post Date we will choose CurrentDateTime.
For the Pointer, we will choose OrgMembers and set the configuration to Automap User’s Address, WalletAddress.
This tells the dTables to pull in the user info by taking the user’s address and matching it to a record in the Members dTable.
Published at Sat, 20 Jul 2019 19:17:02 +0000
Bitcoin Pic Of The Moment
Bitcoin coins photo.
Physical bitcoin statistic coin Antana.
By antanacoins on 2013-10-16 00:45:00
