This article articulates the importance of putting decentralized, blockchain, applications (DApps) into the hands of mobile technology users. More specifically, the importance of providing real-time blockchain data to decentralized applications (DApps) which run on mobile devices. This is the first of many articles. This particular article provides an overview of the smart contract search engine architecture and then provides specific code examples for querying the search engine and API. Future articles will explain the inner workings of the product.
Web traffic from smartphones and tablets first overtook traffic from personal computers (PCs) in mid-2016. Since then mobile handheld devices have become ubiquitous. Whilst their primary use may have started out as a way for us to communicate with each other, the functionality of these devices has grown to the point where they have now become a necessity.
Mobile handheld devices are an essential part of our future
Not only do mobiles provide access to music, videos, books and more. They also allow us to access and transact value (online banking) as well as provide us with access to both the online gaming and global online shopping phenomena.
Just as with a traditional centralized smartphone application (App), the adoption of a, blockchain based, decentralized application (DApp) can be accelerated and sustained if it is provided to the end user via a similarly convenient platform i.e. a mobile handheld device.
Blockchain DApps need data.
Whilst ubiquitous, in terms of mainstream centralised applications (Apps), mobile devices are not able to participate as full blockchain nodes. This is due, largely, to data storage requirements.
In all blockchain protocols each individual node stores all states and processes all transactions. This provides a large amount of security, but in turn requires computational and storage resources which mobile handheld devices do not have.
For DApps to thrive, they need a fast and efficient way to access specific blockchain data in real-time.
From a DApp's perspective, it is not actually necessary for that DApp to request and process data from every block, transaction and smart contract state/event. Generally speaking, a DApp only requires access to a very specific portion of the blockchain. For example, access to a specific smart contract's data, or access to smart contract events within a given range of blocks etc.
Smart contract search engine
Second State has developed a smart contract search engine and Machine to Machine (M2M) API for end-users and DApps respectively. The overall design is shown in the diagram below.
The smart contract search engine can be thought of as a middle layer between a blockchain full node and a decentralised application (DApp). This product is an essential part of the future of DApps.
The search engine architecture is modular by design; providing flexibility and versatility, as well as scalability.
Empowering the individual
The ethos of decentralisation is to empower the individual. This smart contract search engine achieves this in the following ways.
Free and open source software (FOSS)
The smart contract search engine, in-itself, is completely open source.
In its purest form, it uses the following FOSS products/code:
The smart contract search engine is built using FOSS products/code which allow it to be run on consumer grade (common store bought) hardware. It can be deployed:
- privately on local disk using the file URI scheme
- publicly over HTTPS via Apache2
The smart contract search engine and API can index and deliver any combination of smart contract data. For example a smart contract and DApp development team can specifically index the one and only smart contract that is relevent to their project/product. This is done by simply uploading the ABI and transaction address of their deployed smart contract. This selective design contributes greatly to the speed, performance and efficiency of the smart contract search engine, and greatly reduces harware requirements.
Usability - web browser
Searching via the frontend user interface can be done by simply typing text into the search box. Whilst still under reasonably heavy development, at present there are three separate public smart contract search engine websites running.
As mentioned above this product can be used to index as little as one contract. However, in order to test the scalability on consumer grade hardware, we have begun indexing the entire Ethereum MainNet. At the time of writing, the Ethereum MainNet Search Engine has:
- 853,073 contracts indexed,
- 99 unique ABIs uploaded and
- 10,202 contracts with available data (contracts which adhere to the previously uploaded ABIs).
If you would like to see your contract indexed please upload your ABI and Transaction Hash here.
Usability - API
This example returns any of the CyberMiles FairPlay V1 contracts which have “Win” in their title or description.
This example returns one specific type of contract only. Contracts can be searched by passing in the Sha3 hash of the ABI.
The following example queries the Ethereum MainNet for a) smart contracts that are ERC20 compliant and b) smart contracts which have a
The results of the above code are as follows.
This article has introduced the smart contract search engine. This has just been an overview. Subsequent articles will dive deeper into the inner workings of the product. The takeaway points for now are that this product is free and open source and can be installed and operated on consumer grade hardware. It can be used to index as little or as much data as your DApp requires. If you would like to integrate the smart contract search engine into your smart contract/DApp development cycle and/or use this software as a way to take control over the flow of public blockchain data to suit your needs, please contact us via secondstate.io.
The source code to this project can be found at the following Second State GitHub repository.