Categories
Blockchain Finance Financial Services Software

Ethereum gas: how to pay it on behalf of your users

On Ethereum, every transaction that changes the state of a smart contract costs a small fee: this is called gas. Most commonly, end users pay gas while interacting with a smart contract. However, when you’re making a profit on your product by charging some transaction fee or just want to gain many users quickly, you may think about covering the Ethereum gas costs yourself. Well, good news — it’s achievable! In this article, I’ll describe how to do this from both the business side and technical side.

To calculate the precice amount of gas you need to know two factors: Ethereum gas price and the complexity of the operation you want to execute. The current average gas price of Ethereum depends on the current demand on the Ethereum network. Now, let’s see how you can offload the gas costs from the transaction creator to the platform itself.

Blockchain use case: P2P options exchange

The need for offloading the transaction fee in order to achieve cheaper prices is real! We’ve recently faced the problem of moving as much Ethereum gas cost as we can from the end user to the contract creator. The project in question was a blockchain peer-to-peer options exchange, which got a percentage of profit from every successful option settlement. The goal was to encourage people to use the product by waiving any additional cost, just like in non-blockchain solutions.

One of the functions that needed to be free for the users was a standard ERC20 functionality – approve(). User A can allow user B to transfer a certain amount of tokens from user A’s wallet. This method, like any other, normally costs Ethereum gas to execute, but we want to achieve this with no cost to the user. Let’s call the target solution zero-fee allowance. The following requirements must be met for a trusted and secure solution:

  1. The transaction has to be executed by the contract owner, not the end user.
  2. It has to be clear which action is performed by the contract owner on behalf of which end user.
  3. The transaction can be invoked only once.
  4. Two transactions containing two intents by the same end user have to be executed in the order of creation.

Dealing with the Ethereum gas cost challenge

We began by searching through Ethereum Improvement Proposals for problems similar to ours and maybe some solutions. Jackpot! Issue 662 addressed our problem.
After a detailed analysis we were ready to develop our own solution based on what we learned.
We divided the process into 3 parts:

  1. Arbitrary data (the intent) is signed offline using the end user’s private key. The data contains the approve method signature, all parameters and contract address on which the request should be executed. The resulting data signature is sent along with rest of data to the server. Within this step, the user doesn’t make any state changing transactions, so there’s no transaction fee.
  2. The server gets the data from the end user and pushes it to the network using the smart contract owner’s key. The smart contract owner pays the transaction fee.
  3. The contract verifies if the sent data is really the end user’s intent by validating the signature. Then it checks for replay attacks and user intent’s execution order. Lastly, it executes the actual approve function.

Implementation

This part describes the technical solution. So, if you’re not interested in the guts of implementation details, then just skip to the next section, where I’ll discuss the financial aspect of the zero-fee allowance approach.

We based our solution on StandardToken from OpenZeppelin framework. It gave us base methods like the aforementioned approve(). Next, we moved to validating the end user’s intent in the getSigner() function. Firstly, the end user address is recovered from the data signature. Then, the signature is checked against the signature calculated for the arbitrary data passed by the end user. In this step, the intents order is checked by incrementing the nonce value. Lastly, the intent is checked for any previous executions.
After all these checks pass, the flow continues like the standard approve method with the spender address being replaced with the one belonging to the user who signed the message. For readability, the code is split into three methods – checkProvableApprove and provable_approve. The first one is constant and can be used for checking intent correctness, while the second changes the state.

Business calculation of the Ethereum ETH price

Let’s take a look on price per unit that user has to spend per transaction with zero-fee allowance in comparison with the traditional approach.

The gas price and ETH/USD ratio given at the time of writing:

Gas price (Gwei) ETH/USD
49 995.5
Method Gas used Wei cost Ether cost USD cost
Zero-fee allowance 98213 4.81244E+15 0.004812437 $4.79
Traditional allowance 45324 2.22088E+15 0.002220876 $2.21

The conclusion is quite clear. The zero-fee allowance approach costs over 2 times more than when the approve() function is executed directly by the user. In our use-case, that move was worth it, but it should be an individual decision. After all, as the popular song goes, “it’s all about the money”.

If you liked this article, then give it a share. We’ve got more great stuff on our blog (e.g. a guide on how to start an ICO), so make sure you subscribe to our newsletter to be up to date!

Categories
Software Technology Uncategorized

How geolocation and big data can be used to the advantage of your business apps

Nearly all industries have improved their efficiency through the use of geolocation. When it is combined with big data it allows for greater client satisfaction including more individualized customer experience, better targeted marketing and enables you to learn more about your own company.

Geolocation Apps & Big Data

Geolocation is most commonly used in marketing for geofencing, which targets clients who enter a certain location or area. This is often seen in shop apps which recognize when a client is near one of their stores and will then send them special offers, discount coupons, or other promotional information.

In similar vein big data analyses purchases to change or improve offers to better suit the needs of the consumer and allows a company to make their own products more attractive than those offered by the competition. For example a retailer can send special promotions and offers to a client whilst they are shopping in a competitors store. Equally, offers with a small time window can be sent to customers who are currently shopping in one of the company’s own on-line stores. This last example utilizes Beacon technology which works like geofencing but on a smaller scale, i.e. tracking the exact location of a client in the shop.

geolocation apps

Transportation and Logistics

Geolocation is indispensable for transportation and logistics where it is able to get the most out of the huge amount of data produced. Applications utilizing geolocation collate information about traffic jams, road works, quickest routes and allow for the communication of current locations and delivery times between the customer and the service/goods provider. For example, the client can keep track of the person who is delivering his food, and conversely a restaurant can also know exactly when the customer arrives to collect their order. Even within companies it is possible to create more realistic schedules and production timelines based on geolocation information shared between employees.

Social apps

Geolocation has also become an integral part of many social apps allowing users to leave digital markers as they use restaurants, hotels, and bars so that they can  rate their experiences and leave comments for other customers. This also provides increased levels of user engagement as most recently exampled in the huge success of Pokémon Go which showed the possibilities of augmented reality making old forms of advertising suddenly come alive. The same technology can be applied to museums, galleries and other architectural spaces to create virtual tours and even help people negotiate other public facilities such as hospitals or government buildings.

big data apps

Summing up

Geolocation and its various applications are constantly improving, just as are the analytic tools used to interpret and apply the information produced by it. However, it is worth mentioning security concerns that are inevitably produced by the collecting and use of such data. In this regard we should only ask for information that we really need and we should be always transparent about how and when it is to be used. In this way users can always feel safe using our products and can make informed choices on whether or not to disable location on their app.

Want to know more about Espeo? Read about our services HERE.

See also:

Categories
Entrepreneurship Finance Financial Services Software

Micropayments: How your Business Can Benefit From Them

To understand ‘Micropayment’ is to understand the technology connected to it. Technology is constantly improving, affecting every aspect of our lives. One of the biggest challenges in life is simplifying our finances and the best way to do this is via Fintech (financial technology)- a developing area that brings together the best financial products worldwide at the lowest possible price. A crucial part of this is the processing of very small fees that cannot be handled by traditional credit card companies.

This has energized micropayment systems and the whole infrastructure connected with it. While earlier sending small amounts of money was seen as costly, because you still had to pay transaction fees, there were some indicators that micropayments could work:

The popularity of mobile devices

Access to financial services was limited by a lack of technology and the appropriate devices. As a result many transactions were completed on a cash only basis when they occurred outside of the normal banking system. However, the huge popularity of mobile services created an opportunity to provide financial services over its wireless network. Research showed a significant and growing market demand that was particularly important for all GSM (Eng. Global System for Mobile Communications) players. This demand intimated that it was technically feasible and profitable to deploy financial services over mobile networks. The big picture showed that mCommerce might fill a major service gap in developing countries that is critical to their social and economic evolution. Practice shows that the range of features accessible in particular environments can be applied elsewhere if the target markets are similar. With only minor variations from the main stream, the features of all systems need to include:

  • Over-the-air prepaid top-ups using the cash already in the account (like ‘blik).
  • The ability to transfer any amount of money between users’ accounts.
  • Provision for cash deposits and withdrawals.
  • The ability for a third party to make deposits into a customer account (employer, family member or a microfinance organization).
  • The ability to charge for bill payments.
  • The ability to make retail purchases at selected economic outlets.
  • The ability to transfer airtime credits between users.

Since all the above points are now achievable, micropayment has recently been reconsidered as a viable technology, largely due to the development of cellular networks. The main reason for this is not technological but more down to simple economics. Independent online service providers receive much revenue from mobile users. Mobile networks often charge users for admission to low-cost services on a fixed network. Alongside this many applications require a solution for the commissions placed on small transactions containing mass data storage and message exchange.

Insomuch as micropayment systems are designed to purchase exceptionally low-cost items, it is crucial that the value of each individual process remains very small.

online micropayments

Ad blockers plague

As ad blockers have gained popularity there has been renewed interest in micropayments. Originally the main focus in design was on content but emerging technologies using block chain have created amazing opportunities for artists, journalists, etc., as the content no longer has to be ad-friendly. Micropayment has allowed the author to be in absolute control of content distribution and its economic worth. Simply put micropayments drive browsers, empowering creators and the audience that follows them.

Closer examination reveals that when ads are kept out of the way, micropayments allow the author to more easily control their own income. They help reveal the true value of content which assists in ascertaining the authors’ economic sustainability. It is expected that micropayments will continue to evolve just as it did from paid for ads into its current form.

Technicalities – the protocol

As was previously established, the main issue with low-value transactions has been that processing and transaction fees diminish the final settlement amount. Payment processors place additional costs for a multiplicity of reasons including infrastructure costs, administrative costs, and paid mechanisms for fraud prevention and dispute resolution. In the past two decades much research has been undertaken on using digital communications and cryptography to reduce or erase these costs. For banking facilities these fees ideally need to be down to the fraction-of-a-cent range.

It can be expected that content servers for the global information infrastructure will soon operate billions of these low value transactions that are computationally complex. Whilst costly cryptographic protocols are now impractical and obsolete the micro-payment process can be bootstrapped with already well-known payment protocols for larger amounts, but does not depend on them for each micro-transaction. Special attention is given to its integration into IBM’s Internet Keyed Payment Systems (iKP) at its most basic level.
The product itself allows for the possibility of a payment protocol in wireless networks. The protocol usually assumes two techniques of transaction execution:

  • In on-line mode with the participation of a trusted website – for macropayments,
  • In off-line mode using electronic money, mainly for small value transactions – for micropayments.

The main purpose is to predict scenarios of various events and transactions in the protocol – and to be able to analyze any part of it. Paramount within this are the aspects of payment security such as asymmetric cryptography techniques, public key infrastructures and many more. Needless to say that for the evaluation of any protocol, performance must perfectly blend with the criteria specific to the wireless environment.

micropayments platforms

In summary

In summary micropayment platform schemes that are dedicated for processing small transactions work in two main ways.One is that a seller or service provider establishes an account with a third-party micropayment provider who accumulates, stores and distributes the monies accrued. Both seller and user/buyer are required to establish an account with the same micropayment provider for easier and safer implementation. The provider manages a digital wallet where all the payments are stored until they get to to a larger amount and can then be sent to the recipient.As an example let’s say a site called ‘The Freelance’ is a market workplace for freelancers to connect with companies to develop small projects. A company hires a developer from ‘The Freelance’ to make few changes on their website for $1/hr. If the developer works on it for 8 hours, the task giver – the company – pays ‘The Freelance’. In this case ‘The Freelance’ collects all the fees. It also stores the remainder in a developers’ digital wallet. If a developer is good and garners many fees, ‘The Freelance’ accumulates IOUs to the point where the wallet contains a significant sum, say $500, which is then sufficient to be withdrawn. ‘The Freelance’ then pays the developer directly into his account.

The second is that micropayment systems can operate as a system for prepaid transactions. A user/buyer makes use of a micropayment processor account by depositing in advance a certain amount of money in it. As long as the seller (the other side of the primary transaction) uses the same account provider everything works smoothly as the user’s account with the provider is easily debited for the amount of the purchase. Simply put the payment is made by using a micropayment processing account. Let’s illustrate this with the most common example: PayPal. PayPal is a very popular micropayment provider who has its own requirements for micropayments regarding the maximum amount of the transaction. According to PayPal a micropayment transaction is less than $10. So let’s imagine that a PayPal user decides to deposit $200 in their account. From that point user can become a buyer by purchasing an item for $5 from a webstore. The purchase price is debited from the PayPal account and used to cover the payment. On completion the balance in the buyers’ PayPal account will be $195 minus PayPal’s fees for micropayment transactions, the webstore’s balance account is plus $5, and PayPal gains the provision fee.

In all these scenarios, commercial organizations have much more to gain by addressing the problem of fiscal cash transactions by micropayments. Cash is not only more difficult to use, but you waste a lot of time moving it outside the banking sector.

In the 21st century no country exists beyond the scope of the banking sector and so for their own economic progress they should be encouraged to move away from cash. The extra motivation here is that the resulting low cost solutions and mechanisms that work in these environments can then be efficiently applied in all types of developed economies.

Want to know more about Online Payment Solutions and our recommendations?! Read this post:

How to Choose Online Payment Solution!

[contact-form-7 id=”13387″ title=”Contact download_8_reasons”]
Categories
Blockchain Financial Services Other

Smart contract use cases: commodity trading (tiqpit)

Tiqpit’s idea to move commodity trading to the blockchain is one of our most recent smart contract use cases. As co-founder Mike Ziemkendorf said, tiqpit was born out of the move to Malta: the confrontation with the situation on the small island, paired with the founders’ insider knowledge of how commodity trading works. See how tiqpit aims to solve trading problems and how Espeo is helping them to achieve that with blockchain.

How did you get the idea for tiqpit?

The final idea came from a necessity, I guess. Bitcoin and the blockchain idea went mainstream in 2011. Malta, our company location, is a very small island. Seeing the everyday struggles people have there to buy goods made us wonder. We’re 90 kilometers from Sicily and still, everything is so expensive. As traders in different markets and financial instruments, we know what that reality looks like as well. The highest price makes the profit, wetting and speculating… adding to the everyday costs of the end-consumers and leaving the producers with very small margins. Everything is overcomplicated. The confrontation with the local situation, paired with our knowledge about how the end price is set, was the final push for the tiqpit idea to take form.

Since “we cannot solve our problems with the same thinking we used when we created them” (Albert Einstein) blockchain gives us an opportunity to employ a different kind of thinking to solve the problems we created in the past.

So what exactly needed fixing in commodity trading?

TIQPIT - TRADING PLATFORM OVER BLOCKCHAIN FOR COMMODITY MARKETS

Commodity trading is very speculative, centralized, and in the hands of very few market players. It’s a very unfair system. This is exactly what we’re trying to change. We created a vulnerable trading environment, with proprietary matching engines and multiple proprietary protocols. Orders aren’t handled equally and fairly between market participants. This can lead to price manipulation. The system is inefficient and serves only a chosen few. Opportunistic information sharing and intermediary fees add costs and complexity. Of course, the end-consumer suffers.

How is your solution different?

eXAMPLES OF PROJECTS WORKING WITH BLOCKCHAIN SOLUTION IN THE ENERGY AND COMMODITY SECTOR

I know there are other projects and trading-related smart contract use cases. However, almost all of them are mostly based on private blockchain solutions. They’re led by major energy traders, in cooperation with exchanges and banks. Therefore, the projects are kept in-house and for their own use. Everything happens without the involvement of current and future end-customers, producers, suppliers and consumers. br>Tiqpit Solutions applies blockchain technology to create an easy-to-use and inter-operable b>trading, insurance, finance, reporting and risk management platform for all kinds of tradable commodity and energy products. But this time, we created it on an open-source blockchain solution. In one platform, we combine modules for each kind of participant involved in a commodity trade. That’s unique. Our tiqpit platform has no potential conflict of interest against any network participant. It’s tailored to the participants’ needs, with the aim to open the commodity and energy market for everyone.

So, blockchain was the best option?

commodity trading

At this moment, we see blockchain technology as the best solution to decentralize commodity trading. In short, commodity and energy supply contracts can be carried out automatically. They can be performed directly between producers and consumers (peer-to-peer). All other solutions, like cloud based services, will always have the ‘centralized touch’ with some control over trade matching, information flow or settlement.

Blockchain technology is the best way to connect all market participants (small and large producers, suppliers, consumers, authorities and auditors) in a direct and efficient way. Also, it allows participants to take control, by providing instant, real time information flow. At the same time, it offers significant cost reductions – by more than 30% per contract.

In your opinion, what are the challenges for blockchain adoption? Will we be seeing more smart contract use cases?

The technology is still emerging – it’s relatively new, and people tend to be skeptical about new things. Compare it with the evolving Internet in the early 90’s. New technology always has its faults, but, at the same time, it’s very exciting and offers lots of opportunities.  

  • We currently lack a common set of standards for blockchain transactions. We hope that this will be addressed in the near future.
  • I hope we’ll be able to standardize the wide variety of uses for blockchain and form some guidelines. This would help new products, smart contract use cases and services based on the blockchain evolve.
  • Although auditability and transparency are the benefits of blockchain, highly regulated industries may need to develop new rules. Blockchain’s distributed ledger transactions are likely to necessitate changes to industry regulations governing financial reporting, auditing processes or information-sharing regulations.
  • Also, laws will need to be made to govern blockchain’s smart contracts.
  • Of course, let’s not forget the security, vulnerability and validation of the transactions.

But all this will be addressed in the near future, in line with the current developments in the technology and as blockchain business ideas mature in the industry.

How did you come across Espeo, and what have we done for you?

We were searching for someone who would understand our needs from a technical perspective. Espeo provided just that, with your expertise in web design and smart contract development for our upcoming Token Generation Event (TGE). 
Espeo coded the smart contract (Solidity, Truffle, web3.js), including KYC mechanisms (AWS S3, Lambda) and implemented the Ethereum and Bitcoin payment module for the ICO. We also designed and developed the landing page (React.js). Tiqpit could start an ICO and proceed with their plan to revolutionize the commodities market.

blockchain-based product

Where do you see tiqpit in 5 years? What are your plans for the future?

In 5 years, with a 3.0 platform! But we would like to concentrate on the here and now, and create a great commodity trading platform based on the blockchain. See what we’re up to at www.tiqpit.com!