MENU

A chat with Alex Sims

July 16, 2021
0
383
0
Here I catch up with Alex Sims, an Associate Professor in the Department of Commercial Law and a Research Fellow at the UCL Centre for Blockchain Technologies. She teaches a wide range of commercial law subjects. Her primary areas of research and publication are on blockchain technology, in particular, DAOs (decentralised autonomous organisations), the regulation of cryptocurrencies and legal issues surrounding smart contracts. It was great to get some insights into her research and understand more about DAOs, NFTs and lots of other interesting facts along the way.
Read More ›

Some SubQuery How to’s…

July 11, 2021
0
497
0
How to start at a different block height? TL;DR To start a SubQuery node synchronising from a non-zero height, all you have to do is to modify your project.yaml file and change the startBlock key. For example: Why NOT start from zero? The main reason is that it can take a long time synchronising the entire Polkadot mainnet blockchain. Picking a start block such as 500,000 or 1,000,000 allows you to synchronise with the network faster. The other reason is that if you know that you are only interested in say all transactions in the last 30 days, you can figure out the block height 30 days ago and start synchronising from there. What are the drawbacks of not starting from zero? The most obvious drawback will be that you won’t be able to query for data on the blockchain for blocks that you don’t have. How to figure out the current block height? Visit https://polkascan.io/ and pick your network. It will most probably be: https://polkascan.io/polkadot. You’ll then see the block height under “Finalised Block”. Why is it not working? The most common problem that you will encounter is that you did not delete your .data hidden folder. If this […]
Read More ›

How to strip down a SubQuery starter project to its minimum

June 15, 2021
0
349
0
The SubQuery starter project is great way to get up and running very quickly. One drawback however is that it labels its field as “field1, field 2” etc and that it attempts to demonstrate the 3 types of mapping functions, namely block handlers, event handlers and call handers all in one go. This isn’t a bad thing but it can be slightly overwhelming for a beginner. Here, we’ll strip everything down to its bare minimum. TL;DR Delete all the field variables leaving field 1, but rename field1 to blockHeight Remove the handleEvent and handleCall from the mappingHandlers.ts to leave only handleBlock. Update the project.yaml file to remove the unnecessary mapping handlers (linked to #2). Pre-requisite Start by running the standard init command: If you are not sure what the above means, check out this. Step 1: Modify the variables Change the schema.graph from: to We are a) giving the variable a meaningful name and b) simplifying by removing what is not necessary. Step 2: Just keep handleBlock In the mappingHandler.ts file of the default starter project, delete the handleEvent and the handleCall function. We’ll look at these later on. This is what the file should look like. Step 3: Update […]
Read More ›

How to turn on logging in SubQuery?

May 31, 2021
0
466
0
In SubQuery, you can log messages on 3 different levels. They are: For example, adding “logger.info(“info test”) results in: The same can be done with warnings. However, to add a debug log, an extra modification needs to be made. The docker-compose.yaml file needs to have an additional –log-level=debug command passed to it. Here is a screenshot of the docker-compose.yaml file from the Hello World starter project. Also don’t forget to regenerate and build the code first via: and then running:
Read More ›

Hosting a Subql project in less than 5 mins

May 27, 2021
0
765
0
SubQuery provides a very convenient service where you can host your projects for free and the best part about it is that you can get it up and running in less than 5 minutes. Pre-requisites You will have wanted to have gone through the Part 1: Subql Hello World in less than 5 mins tutorial first because tutorial is exactly the same except for the last step. Instead of running the query in Docker, we will run it in SubQuery. You will also need a GitHub account and have pushed your code to a repository. This is because SubQuery will read your code from GitHub. Set up GitHub Log into your GitHub account and create a repository by clicking on “new” in the repository tab. Provide a repo name and choose your visibility and initialisation preference. I’ve left everything as the default for now. Then hit “Create repository”. Once you have this repository, we’ll create our template starter project and push it to this repo. Create your project Next, let’s create a starter project template with the following command: You don’t have to make the project name the same as the repository name but I find that it helps. Then […]
Read More ›

A catch up with Bryan Ventura Mackie from BlockchainNZ

May 24, 2021
0
1138
0
Bryan Ventura is a senior lawyer at MinterEllisonRuddWatts. He specialises in financial regulation, investment law, commercial law, FinTech and virtual assets (cryptocurrencies). His work history includes working as an in-house lawyer at NZX (NZ’s only licensed securities exchange) as well as various business and investment endeavours. Bryan discovered his passion for blockchain technology several years ago when he read the Bitcoin whitepaper. He has since advised or worked on various blockchain and virtual asset (cryptocurrency) projects. Bryan is currently the interim-Chair of the Executive Council of BlockchainNZ. In a short time, he has driven the passion projects of (1) virtual asset service provider regulation (2) virtual asset service providers’ access to banking and (3) digital identity.
Read More ›

Understanding a GraphQL schema

May 17, 2021
0
1052
0
Understanding a GraphQL schema is very confusing at first. There is no scroll bar so you don’t know how long the document is, the structure is hard to visual, and there is a lot of superfluous information for beginners. The trick The trick is to copy all the data into something like https://jsonformatter.org/ and then minimise each section. What is interesting is that within the Query type, there is blockTs and blockT and it is obvious here that blockT requires an argument of id which is of type String and is mandatory, indicated with the exclamation mark.
Read More ›

Understanding the GraphQL docs to write a basic query

May 11, 2021
0
1046
0
Introduction Once you have your project up and running, the next task is to write queries for the data you want to retrieve. Back in the good old days, queries would conjure up the nostalgic SQL SELECT * FROM some_table_name. Nowadays things have changed somewhat. In your playground, ie localhost:3000 if you are running your project in a docker container, you will see two tabs on the right hand side labelled DOCS and SCHEMA. These drawers shoot out when you click on them and they are your bible in understanding what information is available to be queried. It can be daunting to first timers but we’ll step through some concrete examples to understand what this all means. The block timestamp project Before we examine the docs and the schema of this project, if you want to follow along, you’ll have to get the project up and running with a few simple commands. Then navigate to localhost:3000 and you should see the screenshot show above. Expanding each of these tabs will present you with the keywords that you can use to query your node for data. What you can see here is that there are 6 queries you can execute. query, […]
Read More ›

Part 2: Understanding SubQuery (aka Subql) Hello World in more depth

May 7, 2021
0
1189
0
Introduction The article follows from Part 1: Subql Hello World in less than 5 mins where we look under the covers at what is really going on because let’s face it. You can’t really understand anything new in 5 minutes. The exercise was really to get familiar with the technology, test connectivity and see if you could get something tangible working. Subql init The first command we ran was: This does the heavy lifting and creates a whole bunch of files for you. As noted in the official documentation, “you will mainly be working on the following files:” The Manifest in project.yaml The GraphQL Schema in schema.graphql The Mapping functions in src/mappings/ directory These files are the core of everything we do. As such, we’ll dedicate more time to these files in another article. For now though, just know that these files define the graphql schema, ie a blue print or a glossary of how you can query the blockchain, the project yaml file which contains “configuration” type parameters and of course the mappingHandlers typescript which can be seen as the code engine of everything. The next thing we did was: npm install can also be used as well. Short history lesson. Node Package […]
Read More ›

Part 1: SubQuery (aka Subql) Hello World in less than 5 mins

May 4, 2021
0
1313
0
Introduction They say that cooking is quick and easy, it’s the preparation that takes all the time. In coding, it is no different. Getting a Hello World example up and running is quick, but the preparation takes a bit of time. Here we’ll spin up a Hello World sample in less than 5 mins but only if you have the right ingredients. This example will spin up a Subql node, a Graphql engine and a Postgres database. It will then synchronise with the live Polkadot mainnet blockchain, and then allow you to query for the block height. First, let’s do a quick pre-requisite check. Prerequisite check: Run the following: For more advanced users, copy and paste the following: This should return: If you get the above, then you are good to go. If not, install the required applications. Subql Hello world Let’s initialise a starter project with the name subqlHelloWorld. Note that only Author is mandatory. Next change into this directory. Now do a yarn or node install. I’ll use yarn here. Then run yarn codegen Then yarn build: Then run the docker command: This will kick everything into life where eventually you will get blocks being fetched. Navigate to […]
Read More ›

Understanding a docker-compose.yml file

May 1, 2021
0
1202
0
Let’s take look at what the subql docker-compose.yml means. Take for example the yaml file from the starter tutorial. Service The service tag lists all the containers which are included in the compose file and acts as there parent task. (A service definition contains configuration that is applied to each container started for that service). Here there are services defined. postgress, subquery-node and graphql-engine. Image The base image of a container can be defined by either using a pre-existing image on DockerHub or by building an image using a Dockerfile. Here a predefined image from DockerHub is used with the image tag. Specifically postgres:12-alpine, onfinality/subql-node:latest and onfinality/subql-query:latest. Port We then define which port we want to expose and the host port it should be exposed to. eg 5432:5432 for host:container. The ports here are a straight same for same mapping. (A non same mapping would be something like 8080:80). Volumes Volumes are Docker’s preferred way of persisting data which is generated and used by Docker containers. They are completely managed by Docker and can be used to share data between containers and the Host system. There are three types of volumes that can be defined. Normal, path and named. Here […]
Read More ›

Understanding Indexers and Delegators in The Graph

April 25, 2021
0
1877
0
Here is a great video explaining the concents of Indexers and Delegators and the relationship between them in The Graph ecosystem. Source: https://thegraph.com/docs/network#overview
Read More ›

A catch up with John Mackie from BlockchainNZ

April 19, 2021
0
1838
0
John Mackie is a Chartered Professional Engineer specialising in water and is currently involved with the significant reforms occurring in the water industry in New Zealand. His interest in blockchain technology piqued when he understood how this distributed ledger technology could be applied to address global water management challenges. John is a co-founder of the smart meter start-up MeterMe Ltd, which is developing the concept of a distributed ledger for water. On joining the Blockchain Executive Council in 2020, John took on the passion project to assist in improving digital education in blockchain and its related applications.
Read More ›

A catch up with Viktoriya Pashorina-Nichols

March 30, 2021
0
1837
0
Viktoriya Pashorina-Nichols is a general commercial Senior Solicitor at Simpson Grierson who enjoys, in particular, advising startups/early stage companies and seeing them grow on their journey. As part of this role, Viktoriya developed a lot of interest in blockchain technology and the world of cryptocurrencies, which has resulted in her participation as an Executive Council member and Chair of BlockchainNZ. Aside from blockchain and startups, Viktoriya assists with business acquisitions, corporate governance and administration, business structuring (eg through companies, limited partnerships, or joint ventures), capital raising and venture capital funds, and other general commercial/trading arrangements.
Read More ›

A catch up with Shahid Saiyad from BlockchainNZ

February 9, 2021
0
1831
0
Shahid Saiyad is the financial services and blockchain lead at IBM New Zealand and was actively involved in the blockchain community in Asia Pacific before relocating to New Zealand in 2017. Shahid has extensive experience in business transformation, ecosystem development and contributes his experience as a member on the executive council of BlockchainNZ. He has an interest in intelligent workflows, Economics, privacy, data economy and blockchain.
Read More ›

Deploy Solidity helloWorld to Ethereum testnet

January 22, 2021
0
3409
0
Building on from the previous article on creating a helloWorld smart contract, here we will show how to deploy a contract to an Ethereum testnet. The testnet we will use is called Ropsten but there are others can you can choose such as Koven, Rinkeby or Goerli. Step 1: Install Metamask Metamask is a browser plugin that can serve as a crypto wallet and also as a connection to various blockchains to communicate and sign transactions. Install this by visiting: https://metamask.io/download.html Step 2: Change the Metamask network Change the network to the Ropsten testnet. Step 3: Get some test ether To get some test ether, click buy, and then click Get Ether in the Test Faucet section below. Step 4: Deploy your smart contract Change your environment from Javascript VM to Injected Web3. Now when you click deploy, Metamask will pop up and ask you to confirm the transaction. Click confirm. Step 5: Interacting with your smart contract Now you can interact with your smart contract the same way but each time you try and store a message, you will have to pay a small fee (gas) and sign the transaction using Metamask. Here is a link to the smart […]
Read More ›

A catch up with Ann Ibrahim from BlockchainNZ

January 11, 2021
0
3128
0
Ann Ibrahim is an expert in the domain name industry with over 10 years’ experience. Ann currently works at the Domain Name Commission, the regulator of the .nz domain name space and is on the executive council of BlockchainNZ. She has an interest in the technology of decentralisation and is keen to see how the future unfolds in the blockchain world.SHOW LESS
Read More ›

Solidity HelloWorld (updated for 2021) with Remix

December 22, 2020
0
3435
0
It is really easy to get up and running with Solidity smart contracts using Remix which is an online IDE for developing smart contracts in Solidity. If you visit https://remix.ethereum.org/, you’ll see some sample code Removing all the comments to make it less scary, you can see that the name of the contract is “Storage”, there is one variable called number of type uint256 which stands for an unsigned integer that is 256 bits long and then two functions. One to store the number and one to retrieve the number. And that is it really. Read this explanation of functions to demystify the key words such as public, view and returns and this smart contract should be easy to understand. Below I’ve changed the code to store a string instead and changed the contract name to “helloWorld” To run this, you will have to compile the contract first. Then deploy the contract. Now you can store a string and retrieve the string.
Read More ›

A catch up with Daniel Bar from BlockchainNZ

November 30, 2020
0
3214
0
Daniel is an entrepreneur and investor with primary focus on decentralized web technologies. He leads global Blockchain collaborations that involve grassroots developer communities, high performance tech projects, venture funding activities, academic research groups, NFPs and governmental advisory. Here, Daniel talks about what DAOs are, the value they add and shows how to create a simple DAO on DAOStack’s Alchemy.
Read More ›

Understanding DAOStack and joining a DAO

November 22, 2020
0
4201
0
What is a DAO? A DAO stands for Decentralised Autonomous Organisation and with the invention of blockchain technology, in a nut shell has allowed a group of people to make decisions where trust is placed within the technology and the blockchain network. What is DAOstack? From their whitepaper, DAOstack defines themselves as “an operating system for DAOs”. From their website, “DAOstack is an open source project advancing the technology and adoption of decentralized governance.“ Both these definitions don’t mean much to beginner so to explain it another way, DAOstack is a “stack” or a group of technologies that has been invented using smart contracts and blockchains to allow the easy creation of DAOs or Distributed Autonomous Organisations. A more detailed article here goes into much more depth for those inclined. What is Alchemy? Alchemy is a nice user friendly interface for creating DAOs coz let’s face it, this technology is complicated enough without having to do everything in a command line terminal! On https://daostack.io/ you can “Explore DAO’s in Alchemy” which takes you to https://alchemy.daostack.io/ What is xDAI chain? “xDai Chain is a stable payments blockchain designed for fast and inexpensive stable transactions.” ie it is another blockchain network and […]
Read More ›