<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pranay Valson on Medium]]></title>
        <description><![CDATA[Stories by Pranay Valson on Medium]]></description>
        <link>https://medium.com/@pranay.valson?source=rss-715e60058d2b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*450WTp0zDzQpRGc0DTT9dQ.jpeg</url>
            <title>Stories by Pranay Valson on Medium</title>
            <link>https://medium.com/@pranay.valson?source=rss-715e60058d2b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:04:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pranay.valson/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Transaction Fee Estimations: How To Save On Gas? Part 2]]></title>
            <link>https://medium.com/@pranay.valson/transaction-fee-estimations-how-to-save-on-gas-part-2-72f908b13d67?source=rss-715e60058d2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/72f908b13d67</guid>
            <category><![CDATA[asset-tokenization]]></category>
            <category><![CDATA[transaction-fees]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Pranay Valson]]></dc:creator>
            <pubDate>Wed, 20 May 2020 11:01:09 GMT</pubDate>
            <atom:updated>2020-06-17T16:11:40.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVpVntr8Cb0UGNXQWaNQkA.png" /></figure><blockquote>Today, Upvest is excited to announce our improved Fees API, which uses machine learning techniques to enhance gas price stability and overall prediction performance. The European Union Regional Development Fund supports this project as an open-source initiative to benefit the blockchain community.</blockquote><p>In <a href="https://medium.com/upvest/transaction-fee-estimations-how-to-save-on-gas-13c512401aea">Part 1 </a>of this blog series, we covered transaction fee pricing on Proof-Of-Work blockchains (Ethereum &amp; Bitcoin), transfer demand surges, fee volatility, and the resulting necessity for precise gas fee predictions. The second part discusses machine learning techniques that we implemented to create a significantly better fee prediction mechanism, the challenges we faced in the process, the current state and future of transaction fees on the Ethereum ecosystem within the context of asset tokenization. <strong>Let’s get into it!</strong></p><h3>Data Aggregation: Collecting transaction confirmation times</h3><p>As an initial hypothesis to build a regression model for the prediction of gas prices for the Ethereum network, we aimed to determine the distributions of gas prices across a continuous spectrum of confirmation speeds and their corresponding confirmation times. The idea was to look at the fees paid historically for a given confirmation time and estimate what needs to be paid at the time of new transaction submission. Transaction senders would simply provide their desired time for confirmation and would receive the gas price that needs to be paid.</p><p>The supply of available transactions (with the same gas usage) that <em>can</em> be included per mined block stays the same on the Ethereum network due to the gas block limit. Hence, the naive hypothesis applied only to steady demand scenarios and high network stability. The time that a given transaction enters the mempool (unconfirmed transaction pool from which miners select transactions to mine), prior to getting confirmed, is not stored on the blockchain but instead has to be somehow extracted.</p><h4>Generating transaction confirmation data using automated transfers</h4><p>Seeing the need for this data, we developed an automated Ethereum transaction sender, checker, and validator that cycles between 7 different gas prices, 20 wallet addresses, and auto-sends transactions to an <a href="https://infura.io/">Infura</a> node, keeping <em>all</em> other transaction variables intact. For the transaction sender, the time at which a transaction is sent is determined by the timestamp of the last Ethereum block confirmed at the time of sending (the <em>latest</em> block). A previously unselected gas price is chosen, for an available wallet and a transaction is sent to another available wallet where both wallets are owned by the same party. At transaction broadcast time, the transaction hash is logged, enabling the checking of newly mined blocks for confirmation. If the transaction is included in a block that has been recently mined, we establish the actual transaction confirmation time corresponding to the mined block’s timestamp. The time difference between sent time (latest block timestamp at sending time) and confirmation time (transaction found in a block’s timestamp), calculated as seconds (or blocks) waited. Finally, all the gas prices used to send the transactions are stored with the transaction hash as the database key.</p><h3>Data Modelling: Estimating gas prices empirically</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/0*lnXmkFw0cAOGNZ-n.png" /><figcaption>Transactions sent with various gas prices vs blocks waited, fitted to exponential decay.</figcaption></figure><p>The distribution of sent transaction gas prices revealed a variety of transactions going into the network with Gaussian, Poisson, and Delta-like distributions. The plot of gas prices against blocks waited revealed an exponential decay (Poisson Process). To this data, we generated a fit, plotting sufficient numbers of sent mainnet transactions (5K+). As a “static” model, we still could not account for the time-dependent variations of gas prices. After considering plenty of literature for time-series predictions (including multivariate time series ARIMA, GARIMA, VAR models), we selected a Long short-term memory (LSTM), Recurrent Neural Net Model (RNN) to train and test on the constructed database. We could then account for long term gas price correlations taking the parameters from the Poisson fit for transaction confirmation time (blocks waited) as a starting point for the RNN.</p><h4>Challenges faced with model stabilization</h4><p>Under real-time network conditions (tests on the Ropsten testnet were encouraging) on the mainnet, the gas price predictions fluctuated wildly, at times by a degree of order one, i.e. if the gas price was 1 GWei, the models estimated 10 GWei. This model was extremely sensitive to mainnet conditions. Reinforcing the data by using continuous real-time feeds of freshly sent transactions to the RNN (with the automated sender-checker-validator) could not re-stabilize the model. The effect of every new data point in training the network was proportional only to the number of points that came before it. Selecting the tradeoff of data to employ for model training between “current” (freshly sent) transactions VS “historical” (previously sent) transactions depended strongly on the fluctuating demand. We could not know this ratio in advance. An example, when a contract associated with a popular Ethereum game like Cryptokitties is deployed to the network, users rush to upgrade their kittens within a short period to avoid missing out or markets dip due to global calamity, and everyone frantically tries to close out their collateralized debt positions to prevent financial losses.</p><p>How many sent transactions could we log and how much of that data could we ingest at any given time? As it led to more extended training (waiting) times for LSTM RNN models, this was discouraging. Even though we got good accuracy (90%+) while testing on Ropsten, <strong>live mainnet predictions using LSTM RNNs destabilized repeatedly.</strong> We needed a bit more than an empirically estimated formula retrofitted to a univariate time-series prediction model.‍</p><h3>Advances with Data Modeling: Incorporating demand network signals</h3><p>To enable an advanced model in light of the above challenges, we added factors affecting gas price volatility and network properties signalling demand; aggregating and storing them on a minute-by-minute basis for the model re-training. We collected over 45K+ distinct signal points across eight different signals before training any new models. These signals are:</p><ul><li>Number of unconfirmed transactions</li><li>Gas prices provided from various Ethereum public oracles</li><li>Ethereum mining pool reported hashing rates</li><li>ETH vs USD prices, ETH vs BTC prices</li><li>Number of active miners (&amp; workers) in a given pool</li><li>Ethereum total block difficulties &amp; block times <br>‍</li></ul><p>Seeing that the distribution of historical gas prices was far from Normal or Gaussian, we decided it made sense to split it into three models categorized into confirmation speeds, namely — Fast, Medium, and Slow. In the place of making continuous predictions from a fitting function; categorizing them into these buckets prevented estimations of a given speed’s model from bleeding into another. This also preserved some of the Normal/Gaussian-like distribution qualities for those respective speed categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/0*w0Wa1TmfAf27blxr.png" /><figcaption>Ethereum mining pool hashing rates</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/0*vEPmrujlCMaWUU9V.png" /><figcaption>Unconfirmed transaction counts</figcaption></figure><h4>Improving neural networks with hyperparameter grid search</h4><p>With over a month of timestamped network signals <a href="https://drive.google.com/open?id=19bfhjEZhziyA5vNwlinZ71v4PrNOhV7l">collected</a> and merged with Ethereum block info, we trained multivariate regression models employing (deep) Neural Networks. These models first dynamically pick up the best type of regression to use — linear, logistic, polynomial etc., at training time and further, optimize the regression coefficients of the dependent variables for the target — gas price. We then proceeded with tuning the trained models by hyperparameter grid search using K-fold cross-validation. The objective of tuning was to minimize the mean absolute errors (MAE). Thereby bringing strong stability to the estimations. MAE is the average absolute difference between the labels (recorded gas prices) and the predicted values (predicted gas prices) in training data. MAE ranges from zero to infinity, where a lower value indicates a higher quality model. The Neural Network’s hyperparameters were applied from a list of predetermined value ranges and tested for minimizing MAE:</p><ul><li>Number of NN Nodes — 64 to 256</li><li>Number of Layers — 2 to 6</li><li>Hidden layers up to 4</li><li>Cross layers up to 2</li><li>Dropout rates — 0 to 0.375</li></ul><p>These models started being referred to as <strong>“FeNN” or Fee estimations using Neural Networks </strong>resulted in MAEs of ~ 0.34 or below. At training time, we avoided potential input data related manipulation vectors by using feeds from 6 different sources (6 separate providers), logged every minute on an internal server with expanding storage. Simultaneous manipulation of all the sources is highly improbable. With credible sources and reliable signals, we achieved accuracy scores of 0.95 and above, for all model speed categories in predicting gas prices.</p><blockquote><strong>Overall, accuracies for predicting gas prices on the testing set were quite high (&gt;95%) along with the lowest MAEs we had seen in comparison up to this point.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*QizYqRc3zrIAS3Cz.png" /><figcaption>ethgasstation.info Average<em> </em>gas prices time series</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*tJ6ccZSp_wz20z6F.png" /><figcaption><em>medium</em> FeNN model inferences in the same period</figcaption></figure><p>‍We deployed FeNN models for all three confirmation speeds — fast, medium, and slow into production to infer from real-time network stats. First, we found gas price <a href="https://drive.google.com/open?id=1EAeHNYr6vZoeBRxBKCgphF_1acFMTvFn">predictions</a> from these models didn’t vary by order of magnitude one or higher. Second, the confirmation time on each speed category got lower as the models stabilized with more data. These were encouraging signs! As we aimed for cheaper transactions, we went ahead and applied weights for the parameters mentioned above in the model for inference, ranging from 85% to 95% depending on their sensitivity towards estimating gas price.</p><p>Over time we developed significant confidence in FeNN models as they continued to consume more than a month’s worth of network signals and ethereum block information. The recorded inferences from FeNN were logged every minute and then <a href="https://drive.google.com/open?id=1EAeHNYr6vZoeBRxBKCgphF_1acFMTvFn">compared</a> to <a href="https://ethgasstation.info/">ethgasstation.info</a> suggested gas prices (Egs is a very widely used public source for Ethereum gas prices) for an overview of operational performance. The real test, however, was in utilizing these inferences directly to send transactions.</p><h3>Benchmarking Performance: FeNN Vs EGS on the Ethereum Mainnet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zr6K6HGPXm6SMpHZ.png" /><figcaption>Mainnet transactions and Gas Price Vs Time Waited for FeNN &amp; Egs‍</figcaption></figure><p>FeNN’s stability and prediction characteristics enabled sending mainnet transactions continuously over extended periods. Having measured latencies of 103.69 Milliseconds for 95% of the calls to the FeNN API inferring from highly (95%+) accurate models. We refactored the auto transaction sender-checker-validator (described in the Data Aggregation section) for mainnet transfers with gas prices suggested from the <strong>FeNN</strong> API and <strong>Egs </strong>API. Running the auto sender on three parallel threads (fast, medium and slow) while feeding resulting transaction confirmation time and gas prices into a unified database, flagging each transfer with either an Egs (Fast, Average, SafeLow) fee estimate transaction or the FeNN (fast, medium, slow) estimation.</p><p>We confirmed a total of 1403 FeNN API &amp; another 1403 transactions with the Egs API. Both APIs were also queried at approximately the same time (&lt;2 mins), so they saw the same “state” of the network. The benchmark established FeNN’s stability with inferred predictions that were consistent with network conditions (also seen with other providers). The histogram above plots these <a href="https://drive.google.com/open?id=1yD9RQZhuszpf4zdYYSyyIRViMCOT0WPS">results</a> from the benchmarking:</p><ul><li>FeNN led transactions were confirmed cheaper with Egs by 1.862%</li><li>FeNN led transactions were confirmed faster with Egs by 10.21%</li><li>FeNN led transaction performed better versus Egs (Cheaper/Faster) by 18.23%</li></ul><blockquote>As of 11/05/2020, FeNN gas price inferences are overall cheaper by 13.35% compared to Egs. FeNN is also individually less expensive in all categories fast, medium, and slow.‍</blockquote><h3>Full integration into the Upvest Asset Tokenization Engine</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5jcPBMx_mfFlL1O3hAFH1g.png" /><figcaption>Modelling and Integrating the advanced fee API.</figcaption></figure><p>The advanced Fee API blends in quite well into the overall Upvest product suite. As a market leader in the field of asset tokenization, we know that the fee aspects of transactions have a high impact and should not be underestimated. For asset issuers, custodians, or exchanges managing large volumes of high-value transfers, sending transactions with the optimal fees becomes crucial. It is very likely to overpay a non-time-critical transaction or to underpay a time-critical transaction, so it doesn’t get cleared as soon as desired. Reducing the overall fees paid in addition to optimizing the time window of transaction execution benefits these situations immediately.</p><blockquote><strong>Knowing this, we’ve fully integrated the FeNN fee prediction model into our asset tokenization engine.</strong> Clients of Upvest receive this feature for auto-calculating cost-efficient speeds for slow/medium/fast transaction execution times right out of the box.</blockquote><h4>A Glimpse into the future of Ethereum fees</h4><p>Upvest enables abstracting away a lot of complexity for users dealing with Ethereum network transaction fees. Meanwhile, the Ethereum protocol is also continually evolving and taking a closer look at the rather cumbersome fee processes. The current gas price mechanism built into the protocol at Ethereum layer-1 prevents a more straightforward approach. <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md">EIP-1559</a> is the current proposed approach for enabling simplicity, predictability and stability to transaction fees. It was initially proposed by Vitalik Buterin (Ethereum founder) in his <a href="https://github.com/ethereum/research/blob/master/papers/pricing/ethpricing.pdf">Blockchain Resource Pricing</a> paper as a correction for the first auction-based gas price mechanism. It is also purported to bring down needless confirmation delays and increased fairness to the users of the network. A few fundamental changes are planned at the Ethereum consensus layer as a result. It is still ongoing heavy <a href="https://github.com/vulcanize/go-ethereum-EIP1559">development</a> for the next Ethereum <a href="https://www.ethereumcatherders.com/">hard fork</a> as one of the most anticipated upgrades to the economic fee incentive model of Ethereum.</p><h3>Want to try it out or contribute? Get in touch!</h3><p>If you’d like to test-run our advanced Fees API live on the mainnet for your transaction, we gladly invite you to <a href="https://upvest.co/blog/transaction-fee-estimations-how-to-save-on-gas-part-2">sign up</a> and trial the Beta. Curious to know more about how this tool works? Open-sourcing the entire codebase is among our top priorities, and we’re happy to answer any questions concerning the gathered <a href="https://drive.google.com/open?id=1_kzalzrCSnbAHS3vULhrmq00Kukv9D40">data</a>, code contributions and those to be added in the future. We welcome you to participate in our ongoing discussions with the Ethereum community on <a href="https://www.reddit.com/r/ethereum/comments/g4sazq/a_gas_price_prediction_endpoint_for_ethereum/fo0ymu7/">Reddit</a> or reach out directly to the developers (and authors) for any questions or further information — pranay#@#upvest.co / paul#@#upvest.co (remove ‘#’). To know as soon as possible about the open-sourcing of the entire codebase for this project, subscribe to our <a href="https://upvest.noticeable.io/labels/announcement">announcements</a>. We’d be keen to hear from you regarding input for further developments and future collaborations.</p><p><em>Originally published at </em><a href="https://upvest.co/blog/transaction-fee-estimations-how-to-save-on-gas-part-2"><em>https://upvest.co</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72f908b13d67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transaction Fee Estimations: How To Save On Gas?]]></title>
            <link>https://medium.com/@pranay.valson/transaction-fee-estimations-how-to-save-on-gas-13c512401aea?source=rss-715e60058d2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/13c512401aea</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[upvest]]></category>
            <dc:creator><![CDATA[Pranay Valson]]></dc:creator>
            <pubDate>Wed, 19 Feb 2020 16:28:23 GMT</pubDate>
            <atom:updated>2020-05-19T08:27:46.826Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CefESrA3OtVDB8nF3CaHNw.png" /></figure><p>Today, Upvest is excited to launch two new API endpoints — to estimate the <a href="https://doc.upvest.co/reference#ethereum-fees">transaction fee for Ethereum</a> and <a href="https://doc.upvest.co/reference#bitcoin-fees">transaction fee for Bitcoin</a>.</p><p>Transactions executed on the blockchain usually have fees associated with them. The transaction fee provided by the sender determines how fast a given transaction gets processed, legitimated, and confirmed. Therefore, it becomes essential to know how much to pay and understand what confirmation speeds (or times) the varying fee costs are going to get you. In this post, we will describe in detail why we built an <a href="https://fees.upvest.co/estimate_eth_fees">API endpoint</a> (currently in Beta) to estimate such transaction fees and how it helps you save on total fee costs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*NFY1O0PwHHV47EJh9ct7Mg.gif" /><figcaption>Transaction Fee Estimations — In-App User Experience.</figcaption></figure><h3>Transaction Fee Basics</h3><p>Users and developers of products built on blockchains frequently come across the terms <strong>Transaction Fees, Gas, Gas Price, </strong>and<strong> Gas Limit</strong>. Feel free to jump ahead to the next section if you already know what this is.</p><p>For those who are new to this, let’s cover the fee basics for both blockchains. Ethereum and Bitcoin implement the<a href="https://en.bitcoin.it/wiki/Proof_of_work"> Proof-of-Work</a> algorithm in which “ <a href="https://medium.com/swlh/how-does-bitcoin-blockchain-mining-work-36db1c5cb55d">Miners</a>,” i.e., blockchain validators, make use of unique algorithms that require significant amounts of computational effort to solve a cryptographic “problem.” Finding a successful solution to this problem validates a set of transactions and includes them into a cryptographically verifiable block. Essentially, Miners race to find the “golden<a href="https://medium.com/@codetractio/inside-an-ethereum-transaction-fa94ffca912f"> Nonce</a>,” a numerical value that validates a given block. The successful Miner gets compensated for the costs of electricity and computational hardware for solving this puzzle (the “Proof-Of-Work”). This reward for mining a successful block is called <a href="https://www.binance.vision/glossary/block-reward">block reward</a>. It is made up of two components a static block subsidy and a dynamic transaction fee, both usually paid for in the blockchain’s native currency, i.e., Ether or Bitcoin. Block subsidy is usually provided by newly minting a fixed amount of blockchain native currency that goes directly to the Miner and the transaction fee, provided by the sender.</p><p>In the process of building blocks of validated transactions, many competing “forks” form, and exist in parallel at any given time. So, the network continuously determines the main branch on the chain of blocks or the “canonical chain”. An attacker can secretly construct a longer branch sequence and publish it as the canonical chain, by using more than 50% of the network’s computing power (<a href="https://blog.goodaudience.com/what-is-a-51-attack-or-double-spend-attack-aa108db63474">51% attack</a>). This attack becomes more expensive with an increase in the number blocks the attacker wants to overwrite. A 51% attack could affect the network at any time, so transactions are only considered to be confirmed when the blockchain has grown by a certain number of blocks, called the <strong>Confirmation Level</strong>. On achieving a Confirmation Level of <strong>N </strong>(<strong>N</strong> is variable for different blockchains), the mined transaction is considered confirmed. For confirmed transactions found in a given block, both the block subsidy and the transaction fee goes to the successful Miner (or a mining pool). The longer the canonical chain is, after the block that the transaction is in, the higher is the confidence in the transaction’s immutability.</p><p>In addition, in the case of Ethereum, the <a href="https://medium.com/mycrypto/the-ethereum-virtual-machine-how-does-it-work-9abac2b7c9e">Ethereum Virtual Machine</a> (EVM) allows for the execution of smart contract bytecode. Execution of this code could lead to a change of state of the blockchain. A change of state to Ethereum is also transmitted and recorded globally throughout the distributed network. During this entire process, it cannot be known in advance if a computation would end in a fixed amount of time or may presumably, go on forever. This is a well-known problem, aptly named the <a href="https://www.scientificamerican.com/article/why-is-turings-halting-pr/">Turing halting problem</a>. A way to confront this challenge, in Ethereum, is by introducing a cost per unit step of the computation. In general, the more the bytecode to process, the higher the transaction fee. Thus, the total <strong>transaction fee </strong>is the <strong>Gas</strong> consumed (in the computational steps) multiplied by the <strong>Gas Price.</strong></p><p><strong>‍</strong>Now, the end-users (or developers on their behalf) submitting these transactions or calling smart contract functions to make a change of state on the blockchain, need to compensate the Miners in the form of some valuable currency. In the case of Ethereum (ETH) and Bitcoin (BTC), the smallest unit of cryptocurrencies for both chains — Wei (10¹⁸- ETH) and Satoshis (10-⁸ BTC), is the currency used to cover the transaction fees. In the Bitcoin parlance, the fee for transactions is calculated in Satoshis per virtual byte (vbyte) of transaction data. <a href="https://www.blockchain.com/charts">This</a> resource provides a time-series plot of the transaction fee essentials for Bitcoin. In Ethereum, things get a bit more nuanced, documented well in this <a href="https://media.consensys.net/a-guide-to-gas-12b40d03605d">guide</a>. Here’s a summary of the fee essentials for Ethereum:</p><ul><li><strong>Gas Price </strong>is the price a user is willing to pay per unit of <strong>Gas</strong> for the work done in <strong>Gwei.</strong> (1 GWei is 10–⁹ ETH)</li><li><strong>Gas Limit</strong> is the maximum amount of <strong>Gas</strong> you’re willing to pay for the submitted transaction to be mined.</li><li><strong>Transaction fee </strong>= <strong>Gas</strong> consumed (in the computational steps) x <strong>Gas Price</strong></li><li>If <strong>Transaction fee</strong> &lt;= <strong>Gas Limit </strong>x <strong>Gas Price</strong>, the transaction executes and gets mined into a block, the state of the blockchain updates.</li><li>If <strong>Transaction fee </strong>&gt; <strong>Gas Limit </strong>x <strong>Gas Price,</strong> the transaction is reverted, the <strong>Gas</strong> consumed from executing EVM bytecode still goes to the Miner for the computations performed, but the state of Ethereum is not modified.</li><li>As transactions can have varying payloads, varying transactions require varying amounts of <strong>Gas.</strong> Everyday transactions, such as an Ether transfer, have a fixed amount of Gas needed to be processed (i.e., 21,000).</li><li><strong>Block Gas Limit </strong>is the maximum <strong>Gas</strong> allowed in a block (i.e., a maximum amount of computational effort required to process all of the transactions being included within that block). Hence each block has a theoretical maximum number of transactions that it can contain.</li><li><a href="https://etherscan.io/charts">Etherscan.io</a> provides a time series plot of the different essentials.</li></ul><h3>Transaction Confirmation Times &amp; Gas Fee Spikes</h3><p>A <strong>Gas</strong> Fee market results from the demand created by transaction senders and the supply for mining them, determined by the Miners. Both Ethereum and Bitcoin impose a limit on the amount of computation done per block with a <strong>Block Gas Limit</strong>. The amount of time each block approximately takes to be constructed and mined is also fixed, called the <strong>Block Time.</strong> Given that any transaction has a minimum <strong>Gas </strong>consumption and all blocks a <strong>Block Gas Limit</strong>, there is a theoretical limit on the total number of Ethereum / Bitcoin transactions mined in a day<strong>.</strong> Conclusively, both blockchains have a transaction throughput or a maximum number of transactions per second (approximately 31 transactions per second (tps) at the time of writing for Ethereum).</p><p>The proportion of supply and demand determines the “cost” of a transaction or the “cost” of <strong>Gas </strong>(<strong>Gas Price</strong> in Ethereum) at any given time. Therefore, if demand-side chooses to get their transactions included in a block sooner, then they need to pay a higher price for their transactions per unit of <strong>Gas</strong>. In the case of an increase in network activity, the demand for transactions increases; this can lead to a spike in transaction fees. Businesses that often transact on the blockchain or employ smart contracts on a day-to-day basis to automate business logic suddenly find that the transactions they were paying a specific fee for would not get mined unless they were to pay up to ten times as much as before. If the transaction senders are not aware of the fee spike, it often leads to their transactions taking much longer than expected to get mined. In certain circumstances, where the transaction fee remains high, these (relatively) low-fee pending transactions may even get dropped entirely off by the network. If end-users start seeing failed transactions, they get discouraged from executing further transactions, leading to a drop in revenue generating activity on the blockchain for these businesses and also negatively affecting marketplace liquidity.</p><p>An example — when a large number of users interact with smart contracts associated with a popular decentralized application (DApp), Miners start choosing the transactions that offer higher <strong>Gas Price </strong>and <strong>Gas Limit </strong>and other parameters they consider important for their mining strategies. In October 2017, the <a href="https://medium.com/@michaelx777/little-bitty-kitties-are-killing-ethereum-a1253b18b501">Cryptokitties</a> DApp caused network congestion, which resulted in a <a href="https://www.reddit.com/r/CryptoKitties/comments/7pacyn/gas_prices_are_insane/">crazy spike</a>, where the average <strong>Gas Price</strong> went from 5 GWei before the game was released on the mainnet to a value of 50 GWei right afterward. In certain cases, the transaction fees got even higher than the perceived value of the game’s collectible itself.‍</p><p>To overcome such issues, a model that provides fee estimates for various blockchains should consider their network congestions. It should proportionally raise the recommended <strong>Gas Price </strong>to an optimal economical value to get the transaction mined in the required amount of time.</p><h3>An Adaptive Fee API</h3><p>Upvest is excited to release its Transaction Fee API endpoints that model the transaction fee spikes in real-time while making sure that they do not result in unreasonably high estimations. Fee spikes, occurring as a result of circumstances similar to the one mentioned above, are normalized by a proprietary smoothing algorithm. The model calculates the appropriate fee by utilizing data from different public sources for both Bitcoin and Ethereum. It then computes a weighted average from the collected values. The weights on each source may differ depending on its capacity to represent the network’s congestion conditions. The endpoints provide the transaction fee estimates (in blockchain native currencies) in real-time for variable transaction confirmation times (or block times):</p><p>Transaction Fee for Ethereum,</p><ul><li><strong>Fastest</strong>: below 30 seconds (next block)</li><li><strong>Fast</strong>: below 2 minutes (&lt;10 blocks)</li><li><strong>Medium</strong>: around 5 minutes (&lt;20 blocks)</li><li><strong>Slow</strong>: around 30 minutes a.k.a safe-low (&lt;120 blocks)</li></ul><p>Transaction Fee for Bitcoin,</p><ul><li><strong>Fast</strong>: around or below 15 minutes (within 1–2 blocks)</li><li><strong>Medium</strong>: around 30 minutes (within 3–4 blocks)</li><li><strong>Slow</strong>: above 1 hour but below 2 hours (&gt;5 blocks)‍</li></ul><p>The <strong>fastest</strong> prediction for Ethereum should not be used in most cases unless a transaction is to be urgently included in the next block. The <strong>Gas Price </strong>is higher than the market average for <strong>fastest,</strong> to cover for this particular case. A descriptive example for estimating fees for Ether and ERC-20 token transfers can be found <a href="https://doc.upvest.co/docs/transactions-and-fees#section-calculating-fees">here</a>. Try out the API for Ethereum Fees <a href="https://fees.upvest.co/estimate_eth_fees">here</a>. A sample of the returned values in <strong>Gwei </strong>is here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SAqqhYLDV2ZwC52mVMITow.png" /></figure><p>Calculating fees for Bitcoin transactions involves including the number of transaction inputs (<a href="https://doc.upvest.co/docs/transactions-and-fees#section-bitcoin-example">UTXO</a>) and outputs, the number of bytes they represent, and the cost-per-byte. Try out the API for Bitcoin Fees <a href="https://fees.upvest.co/estimate_btc_fees">here.</a> A sample of the returned values in <strong>Satoshis/vbyte </strong>is here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Tt826QYUI7LUa89Oq0UCA.png" /></figure><p>These endpoints can easily handle thousands of requests per second. They are also adaptive (self-healing) such that the endpoints provide accurate estimates even with the degradation of one or more sources. If a data source becomes unavailable, the estimation algorithm ignores the data source by expunging it from the database. In the case of significant network spikes or if some of the sources fail, the Fees API algorithm will still provide reliable estimates. At the time of writing, there are few fee estimation endpoints with these production-ready features. So, we’re super excited to invite you to try them out (in Beta)! Here’s a time series plot depicting fee estimation data for both endpoints:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aw0Iqz73jxMXtUDJ-hCWxQ.jpeg" /><figcaption>Bitcoin — Fast, Medium, Slow (Sats/vbyte) and Ethereum — Fastest, Fast, Medium, Slow (GWei) Fee Estimates</figcaption></figure><h3>An Advanced Fee Prediction API</h3><p>Upvest plans to adapt the current algorithm and use it as a source to develop a more intricate machine learning model to predict fees based on historical transaction data and <a href="https://etherscan.io/txsPending">pending transactions</a>. As we develop the algorithm, we can also extend it to other protocols, provided there are public data sources and historical data availability.</p><p>Do you have unique ideas on estimating transaction fees or want to know how a fee estimation API can help your business? <a href="https://discordapp.com/channels/@me/upheaver#5049">DM</a> our Engineering Lead at Upvest, Paulius Uza (upheaver#5049) on Discord, and if you would like to know more, browse our <a href="https://doc.upvest.co/">documentation</a> and start experimenting with the Upvest Fees API <a href="https://doc.upvest.co/reference#ethereum-fees">here</a>!</p><p>Any other questions? Please send us a <a href="https://twitter.com/upvest/">tweet</a>, or join our <a href="https://discord.gg/TxMr4as">Discord</a> channel to engage with the Upvest developer community. Keep up-to-date with Upvest developments <a href="https://updates.upvest.co/">here</a>.</p><p><em>Originally published at </em><a href="https://upvest.co/blog/transaction-fee-estimations-how-to-save-on-gas"><em>https://upvest.co</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13c512401aea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Easily Calling Arbitrary Smart Contract Functions on Ethereum Part 2 — The How?]]></title>
            <link>https://medium.com/@pranay.valson/easily-calling-arbitrary-smart-contract-functions-on-ethereum-part-2-the-how-8dcb5b193c74?source=rss-715e60058d2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8dcb5b193c74</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[asset-tokenization]]></category>
            <category><![CDATA[upvest]]></category>
            <dc:creator><![CDATA[Pranay Valson]]></dc:creator>
            <pubDate>Fri, 07 Feb 2020 16:14:11 GMT</pubDate>
            <atom:updated>2020-05-07T14:23:16.056Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_dwFatpInp0F9Jh-vxIxvg.png" /></figure><h3>Easily Calling Arbitrary Smart Contract Functions on Ethereum Part 2 — The How?</h3><p><a href="https://medium.com/upvest/easily-calling-arbitrary-smart-contract-functions-on-ethereum-part-1-899605a259f2">In Part 1 </a>of this blog series, we discussed how a crucial step of the Asset Tokenization value chain (investor address whitelisting and token distribution), can be automated using Upvest’s new Complex Transaction (CxTx) endpoint. In this article, we dive deeper into the workings of the CxTx, with a practical example of a <strong>transfer</strong> transaction, which we then extend to batch sending, used for token distribution. By the end of this article, you can call any Ethereum smart contract function yourself, using CxTx.</p><h3>A CxTx “Transfer” Transaction</h3><p>The following JavaScript code <a href="https://github.com/toknapp/code-examples/blob/master/js/ethereum/complex/index.js">snippet</a> is the example of a transfer transaction using CxTx. We discuss this in detail. At its core, the <a href="https://www.npmjs.com/package/@upvest/clientele-api">Upvest Clientele API</a> wraps the Upvest <a href="https://doc.upvest.co/docs/complex-transactions#section-general-purpose-signing-interface">General Purpose Signing Interface</a> (GPSI) mentioned in <a href="https://medium.com/upvest/easily-calling-arbitrary-smart-contract-functions-on-ethereum-part-1-899605a259f2">Part 1</a>. We describe the different parts of the CxTx function call, and then progress to catching the value returned from the request.</p><p>First, we need to instantiate the Upvest Clientele API with the right authentication parameters to make valid function calls. For this, the function <strong>main</strong> is defined as <a href="https://medium.com/velotio-perspectives/an-introduction-to-asynchronous-programming-in-python-af0189a88bbb">asynchronous</a>, and hence can have <strong>await</strong> expressions that free’s up the processor while waiting for the function itself to return a value. The JSON values of the authentication parameters are in this example <a href="https://github.com/toknapp/code-examples/blob/master/js/ethereum/complex/example-config.json">configuration file</a>. We prepare this with the following code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oHE08EOYWEFBiGhf.png" /></figure><p>In the next step, an Ethereum <strong>transfer </strong>transaction is constructed. The JSON values of the CxTx payload is in the same <a href="https://github.com/toknapp/code-examples/blob/master/js/ethereum/complex/example-config.json">configuration file</a>. The payload of the <strong>transfer</strong> transaction is seen here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*79GLGAvpDcbjkUjS.png" /></figure><p>The parameters of the payload are as follows:</p><ul><li>The <strong>type</strong> of CxTx you want to call: in this case, it’s an ethereum function call. Upvest also offers a “raw” function call that can include the payload in binary. The CxTx API accepts only these two types.</li><li>The <strong>to</strong> destination: Ethereum address of the smart contract on which the function gets called, in <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md">EIP 55 </a>mixed-case checksum encoding, including a “0x” prefix.</li><li>The Ether <strong>value</strong> to transfer: if required for a `payable` function, some Ether is sent along with the function call. But this should be set to `0` for `non-payable` functions.</li><li>The desired <strong>gas_limit</strong>: take into account the <a href="https://ethgasstation.info/blog/gas-limit/">maximum amount of Gas</a> the client is willing to spend for this transaction for Gas Limit. You need to know the approximate amount of Gas required for the function call you are trying to make.</li><li>The desired <strong>gas_price</strong> in <em>Wei</em>: this is the price you are willing to pay per Gas “unit.” The Gas Price determines the likelihood with which miners choose to include this transaction in one of the next blocks — an example of how to calculate this is <a href="https://doc.upvest.co/docs/transactions-and-fees#section-calculating-fees">here</a>.</li><li>The CxTx endpoint then takes the <a href="https://solidity.readthedocs.io/en/latest/abi-spec.html"><strong>abi</strong></a> of any (single) smart contract function. This is a JSON object describing exactly how to call this function. Since we call only one function here, only the ABI of that specific function has to be included, and not the ABI of the entire contract (which is also usually a JSON array).</li><li>The function call’s <strong>parameters</strong>: in the above code example, the smart contract address and Ether value. A JSON array listing all values to use for each call parameter. This list has to match with the list of types in the <strong>abi</strong> field.</li></ul><p><strong>Note:</strong> It is mandatory to send the above integers (<strong>value</strong><em>, </em><strong>gas_limit</strong><em>, </em><strong>gas_price</strong>) rendered as base-10 strings (e.g., <strong>“12345”</strong>), to ensure safe transport of up to 256-bit numbers used in Ethereum.</p><p>After the <strong>transfer</strong> transaction is defined, we need to define who’s going to pay the network Gas fee for this transaction. For this, the <strong>fund </strong>boolean in the <a href="https://github.com/toknapp/code-examples/blob/master/js/ethereum/complex/index.js">snippet</a> decides if the auxiliary Upvest funding service should cover the transaction fee. If<em> </em>the funding service<em> </em>covers it, the funding amount is the product of the contract’s <strong>Gas Limit</strong> multiplied by the <strong>Gas Price</strong>. If this boolean is <strong>false</strong>, then the wallet must contain Ether to pay the transaction Gas fee. Upvest can also perform the <a href="https://medium.com/@codetractio/inside-an-ethereum-transaction-fa94ffca912f">nonce</a> management for these transactions. However, the API also allows a specific <strong>nonce</strong> value as a parameter in the payload, should you wish to manage nonces yourself.</p><p>We then call the <strong>createComplex</strong> function from the Clientele API library with the <strong>walletId</strong>, user <strong>password</strong>, the transaction payload (<strong>tx</strong>), and the <strong>fund</strong> boolean. We then call the function<strong> main</strong>, thereby executing the ‘async’ wrapper function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HvpgynXEZpZIcKOo.png" /></figure><p>A <a href="https://medium.com/@justiniso/using-the-polling-module-in-python-87052d7da4d9">polling function</a> to retrieve the transaction hash (<strong>txhash</strong>), is in the lower half of the <a href="https://github.com/toknapp/code-examples/blob/master/js/ethereum/complex/index.js">snippet</a>. This is optional. If included, the polling function returns the <strong>status</strong> of the transaction that is processed. When the actual <strong>status</strong> changes to ‘Confirmed,’ we can be sure that the transaction is mined i.e., included in a block on the blockchain. The various transaction statuses are defined <a href="https://doc.upvest.co/docs/transactions-and-fees#section-transaction-statuses">here</a>. Upvest also advocates using <a href="https://medium.com/crypitor-service/webhook-notification-for-crypto-currencies-cb264dbdfe43">webhooks</a> instead of polling. In the future, Upvest will provide a dedicated webhook API for all customer wallets managed by Upvest. This is what a response looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BcGVzZRQTwo8Z15T.png" /></figure><p>A <em>batch</em> <em>transfer</em> would then involve calling the above-formulated <strong>transfer</strong> transaction in a loop, with a list of wallet addresses and a list of token amounts to be transferred. Thus, achieving the intended purpose of automating the token sale process, for whitelisting of investor addresses and transferring the tokens to them.<br>‍</p><p>If Part 2 of this series resonated with you, sign up for a <a href="https://login.upvest.co/sign-up">free account,</a> browse our <a href="https://doc.upvest.co/">documentation</a>, and start experimenting with the Upvest API. In the upcoming Part 3, we will discuss what we learned from implementing the CxTx endpoint and what’s in store for its future.</p><p>Any questions? Send us a <a href="https://twitter.com/upvest/">tweet</a>, or join our <a href="https://discord.gg/TxMr4as">Discord</a> channel to engage with the Upvest developer community. Keep up-to-date with Upvest developments <a href="https://updates.upvest.co/">here</a>.</p><p><em>Originally published at </em><a href="https://upvest.co/blog/easily-calling-arbitrary-smart-contract-functions-on-ethereum-part-2"><em>https://upvest.co</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8dcb5b193c74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Easily Calling Arbitrary Smart Contract Functions on Ethereum Part 1 — The Why?]]></title>
            <link>https://medium.com/@pranay.valson/easily-calling-arbitrary-smart-contract-functions-on-ethereum-part-1-899605a259f2?source=rss-715e60058d2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/899605a259f2</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[asset-tokenization]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[security-token]]></category>
            <dc:creator><![CDATA[Pranay Valson]]></dc:creator>
            <pubDate>Thu, 30 Jan 2020 16:21:53 GMT</pubDate>
            <atom:updated>2020-05-07T14:23:52.754Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4OVnTipFE1rQvmKZYGYIA.png" /></figure><h3>Easily Calling Arbitrary Smart Contract Functions on Ethereum Part 1 — The Why?</h3><p>Although the vision around bringing real assets onto the blockchain picks up increased interest, the technical implementations, however, are still in their infancy. Upvest aims to enable organizations seeking to bring real assets to the blockchain by providing the essential building blocks to simplify the process from start to finish, enabling an end-to-end customer journey. In a common asset tokenization process, the following core tasks need to be performed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2YPZJizg7bvYk_3C.png" /><figcaption>Asset Tokenization Process, Image<strong>© </strong>Upvest</figcaption></figure><p>A critical section of the above workflow is the whitelisting of investor account addresses and the distribution of tokens, which was largely a manual process up until now. Upvest recently released a “complex” transaction (CxTx) <a href="https://doc.upvest.co/docs/complex-transactions">API endpoint</a>. Using CxTx, this previously manual process can now be fully automated. This endpoint allows any application to execute any smart contract function on the Ethereum blockchain.</p><p>In the first part of this blog series, we’ll explain why we developed the CxTx endpoint, the benefits that come with using it, in conjunction with a practical use case for a fairly standard token sale: address whitelisting and token distribution.</p><h3>A Whitelisting &amp; Token Distribution Workflow</h3><p>The ‘ownership’ of tokens is a state that is maintained within the on-chain smart contract for that token, and it is common to whitelist which addresses are permitted to hold those tokens (and occasionally the amount thereof) at a given point in time. The whitelisting and distribution process can be summarised with the following workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*m4q2hbrAE0GUxbaG.png" /><figcaption>“List” (whitelisting) and “Dist” (distributing) workflow, Image<strong>© </strong>Upvest</figcaption></figure><ul><li>Upvest’s customer (hereby referred to simply as “customer”) formulates a prospectus for the real estate asset, the security token offering &amp; retrieves legal authorization (within their jurisdiction) to mint security tokens compatible with <a href="https://docs.ethhub.io/built-on-ethereum/erc-token-standards/erc20/">ERC-20</a> (or any other ERC) token standard.</li><li>Upvest provides compatibility with ERC-20. The ERC-20 standard is a fungible token standard but any standard can be used with CxTx in essence, as long as it’s in regulatory compliance.</li><li>Real estate assets are then tokenized on the Ethereum blockchain by the customer. Once minted, the tokens are now ready to be distributed to investors (whitelisted Ethereum addresses).</li><li>Potential investors register and sign up on the customer’s platform with a username and password (and other security features the customer’s platform enables like 2FA etc).</li><li>KYC data of the investor (end-user) owning the wallet, is kept on file with the customer issuing the security tokens, in line with regulatory requirements. Once the KYC/AML passes, these wallets can be created using the Upvest <a href="https://doc.upvest.co/reference#kms_wallet_create">create wallet APIs</a>.</li><li>Upon successful registration and KYC, an Ethereum wallet is automatically created via the Upvest APIs.</li><li>Using the Upvest APIs, end-users (the customer’s clients) can manage their digital assets with a username and password, abstracting the complexity of storing private keys and or remembering seed phrases. In the background, private keys are securely stored in the cloud (with the help of Hardware) and all operations involving private keys are performed within the Upvest Enclave.</li><li>CxTx then allows you to whitelist all the investor’s Ethereum addresses to receive tokens (one-by-one in interaction with a smart contract, in a finite loop).</li><li>As a next step, the tokens are now distributed to the addresses of the whitelisted investors using CxTx.</li><li>After the successful distribution, Upvest Webhooks allow the customer to receive information on token transfer events, to and from investor wallets.</li><li>Eventually, a secondary market can be opened up for the trading of these particular security tokens by following the issuer’s needs and regulations.</li></ul><h3>Reduced costs associated with Compliance, Regulations &amp; Custody</h3><p>Customers using the CxTx can define and call custom smart contracts functionalities, based on the predefined level of control legally bound by their prospectus (for an asset they want to tokenize). Leveraging Ethereum is thereby a medium of a permanent record that adds value, as this data itself does not have to be maintained by the customer platform. The customer’s client can hold the assets in self custody if so required, which brings down costs of traditional custodians (banks). As a consequence, neither Upvest nor Upvest’s customers (tokenizing the real estate assets) can initiate transactions without the involvement of the end-user who holds the wallet.</p><p>Upvest also provides functionality to completely offboard the customer’s end-users in the future, if need be. This greatly eases the effort on the customer’s end, when compared to the necessity of maintaining a paper trail of the assets and a digital representation of the same, both of which are required to be maintained by law. CxTx further adds benefits, such as the transaction is broadcasted by Upvest and funding of the transaction (Gas) fees is internally managed, which means a signing wallet is not required to have Ether in it. Also besides, Upvest can track this transaction from broadcast to confirmation (or failure) and report accordingly.</p><p>Moreover, smart contracts automatically enforce regulations concerning these securities. Thus freeing up the customer platform from having to ensure that every investor abides by these regulations. In essence, the Ethereum wallet generated by Upvest is owned by an accredited investor (with a given address). The investor has an amount of security tokens representing ownership of the real estate assets at a particular location, at this particular time <a href="https://www.mycryptopedia.com/block-height-explained/">(or block height)</a>, in this wallet. This can also be referred to as a “snapshot”. The snapshot then gives the customer an idea of the assets held by the individual investor at any given time in the present and the past to calculate payouts or dividends.</p><p>This process also does not include storing KYC/AML data (except on the customer’s platform), and any personally identifiable information (PII), on the Ethereum blockchain, thereby complying with <a href="https://medium.com/swlh/gdpr-compliance-everything-you-need-to-know-ef75a7ffe35a">GDPR</a> (General Data Protection Regulations). These added benefits help in bringing down overall costs by up to 80%, compared to traditional processes involved for retail investment in real estate.</p><h3>An Initial Solution: General Purpose Signing</h3><p>Previously, anyone who would have liked to call a smart contract function could in principle also have done the same with the assistance of the Upvest’s <a href="https://doc.upvest.co/docs/complex-transactions#section-general-purpose-signing-interface">General Purpose Signing Interface.</a> The lowest level of Ethereum functionality is made accessible via the Upvest GPSI. Hence GPSI is the most versatile in function since it can be used to sign any arbitrary binary payload. However, it is also the most involved in the customer’s end, requiring basic knowledge of public-key cryptography and adherence to Ethereum standards ( <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md">EIP-155</a>). The following customer workflow could have been used, in principle, with GPSI to comply with the above use case:</p><ol><li>Register for webhook callbacks with the Upvest platform</li><li>Assemble the binary representation of the transaction</li><li>Hash the resulting transaction</li><li>Call the Upvest GPSI endpoint to sign the hash of the transaction with the desired wallet’s private key</li><li>Incorporate the newly generated signature into the transaction</li><li>Broadcast the signed transaction to the Ethereum blockchain</li><li>Wait for the transaction to get mined into a block (confirmation) and receive callbacks from the Upvest platform</li><li>Confirm the transaction as valid</li></ol><p>The process, in summary, boils down to quite a very quirky request format for an Upvest customer that would just like to call a smart contract function in the easiest way possible. CxTx, however, has been implemented with a flexible interface and an end-user workflow, so that any company, leveraging the Ethereum blockchain can call smart contract functions using it. To explain how this is done, we are discussing CxTx in detail with a code example in <a href="https://medium.com/upvest/easily-calling-arbitrary-smart-contract-functions-on-ethereum-part-2-the-how-8dcb5b193c74">Part 2</a> of this blog.</p><p>If Part 1 of this series resonated with you, sign up for a <a href="https://login.upvest.co/sign-up">free account,</a> browse our <a href="https://doc.upvest.co/">documentation</a>, and start experimenting with the Upvest API. In the <a href="https://medium.com/upvest/easily-calling-arbitrary-smart-contract-functions-on-ethereum-part-2-the-how-8dcb5b193c74">Part 2</a>, you can learn more about how to use the CxTx endpoint with a code example. Then in Part 3, we will discuss the future developments for the CxTx endpoint.</p><p>Any questions? Send us a <a href="https://twitter.com/upvest/">tweet</a>, or join our <a href="https://discord.gg/TxMr4as">Discord</a> channel to engage with the Upvest developer community. Keep up-to-date with Upvest developments <a href="https://updates.upvest.co/">here</a>.</p><p><em>Originally published at </em><a href="https://upvest.co/blog/easily-calling-arbitrary-smart-contract-functions-on-ethereum"><em>https://upvest.co</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=899605a259f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>