Schlagwortarchiv für: Ethereum

Overview

This is a simple working example of a flash arbitrage smart contract, whereby within a single transaction it:

  1. Instantly flash borrows a certain asset (ETH in this example) from Aave lending pools with zero collateral
  2. Calls UniswapV2 Router02 to wrap the flash liquidity of ETH into WETH and exchange it for DAI tokens
  3. Checks the exchange rate of DAI back into ETH on Sushiswap V1
  4. Calls SushiswapV1 Router02 to swap the DAI back into WETH and then ETH
  5. There’s also an independent function to withdraw all ETH and ERC20 tokens at the contract owner’s discretion

Before you start playing with this I highly recommend to have a read of the Aave Flash Loan mechanism and get an indepth conceptual understanding, as it’s equally important as understanding the code.

Since Sushiswap is a fork of UniswapV2, I also suggest familiarising yourself with the Uniswap V2 guide on trading via smart contracts, particularly if you plan on adding more swaps to your arbitrage strategy.

Deployment

The contract can be plonked directly onto Remix, using solidity compiler 0.6.12, and Metamask using Injected Web3.

On deployment, set the following parameters:

  • _AaveLendingPool: the LendingPoolAddressesProvider address corresponding to the deployment environment. see Deployed Contract Instances.
  • _UniswapV2Router: the Router02 address for UniswapV2 see here.
  • _SushiswapV1Router: the Router02 address for SushiswapV1. There isn’t an official testnet router02 so for demo purposes you can just use the uniswapV2 address when playing on the testnet since their codebase is identical (for now – which may not be the case in the future). Alternatively see Sushiswap repo for the mainnet router02 address to test in prod or deploy your own version of Router02 onto testnet.
  • Click ‚transact‘ and approve the Metamask pop up.
  • Once the flash arb contract is deployed, send some ETH or ERC20 token to this contract depending on what asset you’re planning to flash borrow from Aave in case you need extra funds to cover the flash fee.

Execution

On execution, set the following parameters:

  • _flashAsset: address of the asset you want to flash loan. e.g. ETH is 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE. If you want to flash anything else see Reserved Assets but you will need to adjust the executeArbitrage() function accordingly.
  • _flashAmount: how much of _flashAsset you want to borrow, demoniated in wei (e.g. 1000000000000000000 for 1 ether).
  • _daiTokenAddress: for this demo we’re swapping with the DAI token, so lookup the reserved address of the DAI token. See Reserved Assets.
  • _amountToTrade: how much of the newly acquired _flashAsset you’d like to use as part of this arbitrage.
  • _tokensOut: how much of the ERC20 tokens from the first swap would you like to swap back to complete the arb. Denominated in actual tokens, i.e. 1 = 1 DAI token.
  • Click ‚transact‘ and approve in Metamask.

Result

If all goes well, a successful execution of this contract looks like this (Ropsten testnet).

Tips for further customization

  • This contract would typically be executed by a NodeJS bot (not part of this demo) via a web3.eth.Contract() call, referencing the deployed address of this contract and its corresponding ABI. You would usually get the bot to interact with price aggregators such as 1inch to assess arb opportunities and execute this contract if the right opportunity is found.
  • To have any chance of getting in front of other arb bots on significant arb opportunities the NodeJS bot needs to be hosted on your own fast Ethereum node. You will most likely come off second best going through the Infura API to interact with the Ethereum blockchain.
  • Some people like to get an unfair advantage by building Transaction-Ordering Dependence (front running) capabilities into the NodeJS component, typically using web3.eth.subscribe(‚pendingTransactions‘..) to monitor for newly submitted arb TXs. However this smart contract would then need to be significantly more complex and flexible enough to cater for a wide range of arbitrage permutations across multiple protocols.
  • User specified parameters (as opposed to hardcoded variables) should be passed via the flashloan() function in the first instance. You can subsequently set these parameters to contract variables with higher visibility across the contract.
  • There are no direct ETH pairs in UniswapV2 therefore the need for a WETH wrapper. Since Sushiswap is forked from UniswapV2 you’ll need to wrap in WETH as well.

If you found this useful and would like to send me some gas money:

0xef03254aBC88C81Cb822b5E4DCDf22D55645bCe6

Thanks, @fifikobayashi

Source: https://github.com/fifikobayashi/Flash-Arb-Trader

The legislation enables banks to sell and store cryptocurrencies from January 1, 2020. Other providers will now require a German license.

The German parliament today passed a bill allowing banks to sell and store cryptocurrencies from next year.

The new legislation will come into force on 1 January 2020, and will require current custody providers and crypto exchanges operating in the country to take steps, before the end of the year, to apply for a German license.

The law will not only put Germany, the world’s fourth biggest economy, at the forefront of regulation in cryptocurrencies, but heralds a milestone in the adoption of cryptocurrencies.

“Germany leads the way in crypto regulation, for sure. This leads to institutional investors coming to Germany, as they want security and regulation,” Sven Hildebrandt, partner at German crypto consultancy DLC, told Decrypt. „Germany is well on its way to becoming a crypto-heaven.”

The bill was passed by the Bundestag, the lower house of the German Parliament, earlier this month,  and approved by the upper house, the Bundesrat, today.

It amends a clause in the European Union’s Fourth Anti-Money Laundering Directive that currently prohibits banks from dealing directly in cryptocurrency. It  allows them to legally sell and store cryptocurrencies, just as they do stocks and bonds, to retail as well as institutional investors.

At the same time, exchanges such as Binance and Kraken, and other digital asset custodians, will need to obtain a license from the German regulator, Bafin, if they wish to continue operating in Germany, said Hildebrandt.

In order to apply for this, companies will need a German legal entity with two directors operating in the country by the end of 2019. They also need to signal their intention to apply to Bafin for a license before 31 March 2020, and submit the application prior to 31 November 2020.

Digital asset custodians who have not established a legal identity in Germany before the end of the year will be deemed illegal by 2 January 2020, said Hildebrandt.

He said this leaves companies wishing to continue provide services in Germany with three options: to set up a German company before the end of this year, and then apply for a licence; to work with a cryptocurrency custodian who is licensed in Germany, or to work with a licence provider, which can offer a “complex but clever“ solution.

Companies have already begun to act on the new German law. Crypto Storage, a subsidiary of Swiss financial services provider, Crypto Finance announced plans to open an office in Frankfurt today.

Hildebrandt said that the new law will be a major breakthrough. “If you can hold [cryptocurrencies] in your bank account, that is massive for adoption,” he said. “I believe that this will act as a role model for all the other laws that will be coming into force Europe wide. Germany is driving crypto adoption forward and wants to play a leading role in Europe as well. One of the key challenges is keeping private keys safe.”

“I believe the biggest impact will be on exchanges such as BitStamp, Kraken and Binance, who are looking deeply into this,” he added.

The proposals were also greeted with enthusiasm by Germany’s banking community.

But consumer protection watchdogs have warned that it could mean banks could aggressively pitching cryptocurrencies to uneducated customers, putting them at risk.

Source: https://decrypt.co/12603/new-law-makes-germany-crypto-heaven

This article explains how someone will be able to become a validator in Ethereum 2.0. New Ethereum will replace mining process as seen current Ethereum and use Proof of Stake consensus where validators will be the one maintaining the network. Those validators attestations are written on the Beacon chain. However, we won’t get into those technical details and you don’t even have to know all of that to take part in validating blocks.

What’s the current status of Ethereum 2.0 development?

Specification is there and seven different node clients are actively working on their implementation. The reason for this is that they are written in different languages and will have a different specializations i.e. being focused on the browser or resource constrained devices. Also, not all of them will survive (but that’s ok). In current Ethereum (Eth1) survivors are Geth and Parity. Current active Eth2 clients are: LodestarNimbusLighthousePrysmTrinity and Harmony + Artemis that should merge together.

They all have their own testnets but they all gathered in September on an interoperability event and created a multi-client testnet. Here is the historic tweet and we are glad that we could be there! Thanks Consensys.

First launch of the Ethereum 2.0 clients, tweet by Joseph Delong

Good news is that in the latest Eth2 spec release (v0.9.0) an official deposit contract has been declared as finished!

All inital deposits, that will happen on Eth1 chain, will be used by Eth2 chain to secure the network upon launch by leveraging the security pool and value of existing Ether.

How much can you earn by being a validator?

What a great question! Yes, you get a reward if your attestations get included in a block but the reward depends on the whole state of the network i.e. how many validators are online. The economics of this are still being examined and are to be tested. Latest estimates are that validators can expect 4.6% – 10.3% in annualized rewards. However, the spec is still being updated which results in a lot of estimates so we can only recommend you the following links to understand better: – Examining the Proposed Validator Economics of Ethereum 2.0 – Eth 2.0 Economics

Basically, the math for validator return of investment (ROI) is:

ROI = Validator rewards + Network fees - Cost to run a validator node

The goal is to encourage people to become validators and have many as possible to secure the network. Therefore, the whole PoS system is a collective rewards scheme where the more people online, the more everyone earns. Vice versa, the less people online, the less that people are earning. It is why there is a slight penalty if your validator client goes offline at any point. For example, if the current interest rate is 5%, you would lose 0.0137% of your deposit every day, but gain that for every day you’re online. In case of a bigger issue where 33% of validators are offline and you’re offline, you can lose 60% in 18 days. If at any point your deposit drops below 16 ETH you will be removed from the validator set entirely.

Unfortunately, the numbers above in the links are most probably going to be changed as the Eth2 spec is constantly being updated.

What do you need to become a validator?

Basically, here are the minimum requirements for being a validator: – have 32 ETH, – run validator node 247 (this can be your PC, remote server, Raspberry Pi or similar) with Internet connection, – have access to beacon node.

Hardware requirements for running the node will be better determined during testnet activities. For the validator client only something like Raspberry Pi will be enough but in case you are running your Beacon node, you’ll need a more powerful CPU and storage space.

Keep in mind that your uptime and therefore an Internet connection are the most important things as your stake gets slashed if you are offline, meaning that you are losing your money.

How to become a validator?

The validator setup requires some technical knowledge and understanding. However, we want to enable everyone to easily become a validator and know how well they perform. This will be possible with the desktop app that we are working on – ChainGuardian. Soon more info about that, you can track for progress our NodeFactory Twitter and ChainGuardian Github or join our Discord! This app is being built thanks to MolochDAO.

ChainGuardian is a Windows/Linux/Mac app that will be a one stop shop for validators. As a user, you will be able to fully onboard as a validator which includes: making an ETH deposit, generating or importing your required key pairs (which only you own!), running a validator client and a Beacon node. Most importantly, you will be able to observe the performance of your node, return of investment and get notified if your node is down so you don’t lose your earnings!

Here are a couple of sneak peaks below. We plan to expand these features to much more but currently we are focused to make a release where you can make an ETH deposit and effortlessly become a validator.

ChainGuardian desktop application previews

Basically, to become a validator, here are the steps that one needs to take:

  1. Install one of the previously listed Eth2 clients.
  2. Get Ether. In testnet case that’s Görli ETH. We understand this is not so easy to get so we will provide a faucet for you that will get you this ETH and submit your deposit transaction altogether.
  3. Generate a validator public and private key pair (used for signing your claims as a validator).
  4. Start your validator client along with Beacon chain. You can use your Beacon chain node or some existing public server.
  5. Make the ETH deposit (stake) to Eth1.
  6. Wait to get assigned as validator. Once your validator client is up and running you just have to wait for it’s activation. This takes a few minutes (or probably hours in case of mainnet) because of a voting period in which new deposits are added to the running chain from other validators.
  7. Watch your validator create, vote and attest for blocks as well as earn rewards!

Once again, those steps will be a part of the ChainGuardian app onboarding.

Note about your key pairs

What’s important to understand when handling your validator node are validator keys. You should have a signing key which is a hot wallet – unlocked account that app client uses for voting and proposing blocks. Also, you need a withdrawal key that is a separated cold wallet which will be used for funds withdrawal in case you want to stop being a validator or your signing key gets comprimised.

Conclusion

This is Ethereum 2.0 (Serenity) Phase 0 which includes launch of Beacon chain that manages the Casper Proof of Stake protocol for itself and all of the shard chains. Being a Phase 0 only, we won’t have all the new features of Ethereum 2.0 just yet. For example, there is currently no way to withdraw deposited Ether from Eth2 as it is effectively burned in Eth1. However, although the transfers weren’t planned in Phase 0, this is still open to discussion and changes.

Once Phase 0 is complete, there will be two active Ethereum chains – Eth1 chain (current) and the Eth2 chain (Beacon chain). They will operate in parallel during the Phase 1 and Phase 2 as well. However, the Eth1 to Eth2 transition is planned.

For the Beacon chain to start, there will be a minimum amount of ETH stake needed. It is defined in the deposit contract and currently this is set to 16384 validators (524,288 ETH).

It may seem that this Phase is not that significant as we won’t be available to use everything from Ethereum that we got used to but this is the foundation of the entire system. If we compare this phase to the beginning of the mining period, then we can certainly draw conclusions about advantages and profits in being the first in the line. However, there are all kinds of risks but seeing the community around this and efforts of the core developers, it’s only possible to be positive about how things will roll out.

Source: https://www.nodefactory.io/blog/how-to-become-a-validator-in-the-new-ethereum-2-proof-of-stake-system/

Graham McBain
 · 2 min read

Using Bubble.is and Portis.io

Photo by Kyle Hanson on Unsplash

Protocols like Compound Finance and DYDX are arguably the most compelling reasons why you’d want to build an app on Ethereum. Unfortunately the entire web3 stack is surrounded by a cloud of wonky terminology and technical barriers. This jargon minefield makes it next to impossible for the average Jane to get something up and running.

Until now

I’ve been working on an simple MVP Portis plugin that allows anyone to utilize these and other protocols with no programming knowledge. To do this I leveraged a platform called Bubble.is, a visual programming language with powerful workflow automation tools.

The first step in making this possible is integrating a wallet provider. I’m a big fan of Portis and integrating their wallet has proven to be very easy. All this took was a few evenings and emails to the team to talk about problems I ran into. This work has resulted in the first tool which lets a non developer create a Dapp, all in under 2 minutes. Weiterlesen

1. It needs 2 million deposited Ether to start
We covered previously how a validator would need to submit 32 ether to a deposit contract to join the staking system in Ethereum 2. What isn’t as widely known is that we need 65536 validators for the new chain to start – roughly 2 million ether (65536 validators). That’s exactly 64 validators per planned shard in the system – too little at first (see numbers below).

Es hat ein wenig gedauert, bis das Bundesfinanzministerium das Urteil des Europäischen Gerichtshofs zur bundesdeutschen Tatsache gemacht hat. Aber nun ist es soweit. Sorgen, dass es irgendwie doch noch zu einer Verumsatzsteuerung von Bitcoin-Verkäufen kommt, haben sich damit endgültig erledigt.

Nachdem wir vor etwa zwei Wochen die Meldung hatten, dass das Finanzamt Bonn-Innenstadt versucht, von einem Bitcoin-Unternehmer die Umsatzsteuer für den Verkauf von Bitcoin zu verlangen, hat dies für ein gewisses Entsetzen in der Szene gesorgt. Unbestätigten Berichten zufolge hat dies zu Schlaflosigkeit unter Bitcoin-Tradern geführt und in einem extremen Fall sogar eine Psychose ausgelös. Manch ein Trader begann, sich wegen der potenziell hohen Umsatzsteuernachforderung um seine wirtschaftsliche Existenz zu fürchten. Mit ausgelöst wurde die Unruhe etwa durch Berichte des Steuerberaters Rüdiger Quermann sowie des Rechtsanwalts István Cocron.

Experten wie der Steuerberater Diplom-Kaufmann Christian Densch aus Essen, der als „Kryptotaxpert“ Gastgeber einer beliebten Facebook-Gruppe ist, haben von Anfang an energisch darauf hingewiesen, dass hier unnötig Panik verbreitet wird. Die Forderungen des Finanzamtes Bonn-Innenstadt seien in keinster Weise zu halten. Sie seien auch kein Ausfluss einer wie auch immer gearteten Verschwörung der Finanzämter, die nun versuchten, Bitcoin kaputt zu machen und die Bitcoin-Trader zu ruinieren, sondern lediglich das Ergebnis einer gewissen Trägheit der Behörden. Es sei weder notwendig, sich Sorgen zu machen, noch angebracht, Ängste zu schüren oder gar das persönliche Armageddon zu verkünden.

Wie sich bald darauf zeigte, hat der Steuerberater Christian Densch recht. Ihm gelang es im persönlichen Gespräch und einem darauf folgenden E-Mail-Verkehr, eine zur Veröffentlichung freigegebene Einschätzung von Dr. Christian Hufen zu bekommen. Dr. Hufen ist Persönlicher Referent des Parlamentarischen Staatssekretärs des Bundesministeriums für Finanzen, Dr. Michael Meister. Er schreibt, dass sich Kryptotaxperts „Vermutung, dass der Umtausch von Bitcoins in andere Währungen unter eine Umsatzsteuerbefreiung fällt, bestätigt“ hat. Es gilt die Entscheidung des Europäischen Gerichtshofes im Fall Hedqvist. „Danach handelt es sich bei dem Umtausch konventioneller (gesetzlicher) Währungen in Einheiten der virtuellen Währung ‚Bitcoin‘ und umgekehrt um eine Dienstleistung gegen Entgelt, die unter die Steuerbefreiung nach Art. 135 Abs. 1 Buchst. e der Richtlinie 2006/112/EG des Rates vom 28. November 2006 (sog. EU-Mehrwertsteuer-Systemrichtlinie, MwStSystRL) fällt.“

Der Steuerberater Densch hat noch einige weitere Fragen gestellt – etwa zum Mining oder zur steuerlichen Handhabung von Zahlungen mit Bitcoin – auf die der Persönliche Referent interessante, und im großen und ganzen auch erfreuliche Antworten gibt. Aber dazu ein andermal mehr. Hier sollte man feststellen, dass das Thema der Umsatzsteuer für den Verkauf von Bitcoins vom Tisch war.

Ein Schreiben des Bundesfinanzministeriums an die obersten Finanzbehörden der Länder vom 27. Februar, das auf der Webseite des Ministeriums veröffentlicht ist, bestätigt nun auch gegenüber den Behörden die Anwendung des Urteils des EuGH und bestätigt den Inhalt der E-Mail, die “Kryptotaxpert” bereits am 21.02.2018 auf seiner Seite veröffentlicht hat. Beim Umtausch von Bitcoin in Euro handelt es sich um eine „steuerbare sonstige Leistung, die im Rahmen einer richtlinienkonformen Gesetzesauslegung nach § 4 Nr. 8 Buchst. b UStG umsatzsteuerfrei ist.“ Die Grundsätze dieser Anordnung seien in allen offenen Fällen anzuwenden. Wer also sich noch irgendwie von der Umsatzsteuer bedroht fühlt, kann nun offiziell aufatmen.

Warum aber hat das Bonner Finanzamt nun trotz all dem einen Umsatzsteuerbescheid erlassen? Die Antwort darauf dürfte einen interessanten Einblick darin geben, wie deutsche Behörden zu arbeiten verpflichtet sind. Die Hauptsachgebietsleiterin Betriebsprüfung und Gewerbesteuer beim Finanzamt Bonn-Innenstadt verwies im Rahmen eines Telefonats mit Herrn Densch darauf, dass ohne Anwendungsschreiben der vorgesetzten Behörde ein EuGH Urteil nicht unmittelbar durch das Finanzamt umgesetzt werden darf. Unglücklicherweise orientierte sich die Verwaltungsmeinung noch an der Auffassung des BMF die Umsätze mit Bitcoin unterliegen der Umsatzsteuer. Das Finanzamt Bonn-Innenstadt hatte somit keine andere Wahl, als den mißliebigen Bescheid zu erlassen, auch wenn es sich selbst im klaren war, dass dieser nicht rechtens sein kann.

Es wäre interessant, wenn sich der Betroffene auch einmal zu Wort melden würde, bei der Aufregung, die um dieses Thema erzeugt wurde, dürfte ihm das ja nicht entgangen sein.

Source: https://bitcoinblog.de

https://etherscan.io/address/0xab5801a7d398351b8be11c439e05c5b3259aec9b

Metaphorical cheers and laud claps were heard across eth spaces as cats were once again seen roaming freely on the blockchain following a raising of the gas limit by ethereum miners.

Ethereum’s capacity has now risen to 7.6 million computations per block, up from around 6.7 million, and seems to continue rising at the time of writing.

As can be seen above, blocks are still full because thousands of transactions are waiting to move, but the queue has been dropping from 25,000 to 20,000.

Fees are also coming down. They were at 57 cent yesterday, now they stand at 28 cent and might drop further in the coming hours/days.

It is unclear at this stage whether miners have raised the gas limit following some simple protocol improvements, or whether they have opted to give the network some breathing room while we wait for these improvements

Read the full article: http://www.trustnodes.com/2017/12/10/ethereum-miners-save-kitties-capacity-raised

Unless you’ve been living under a rock for the past three years, you have surely taken notice of an industry buzzword that has been giving “machine learning” a run for its money: Blockchain.

Ethereum is one of the most successful implementations of the distributed blockchain concept. In contrast to Bitcoin, which offers limited scripting capabilities, Ethereum provides a Turing-complete virtual machine. State transitions in the network (such as a changes in account balance of a particular token) are regulated by code running in the virtual machine, a.k.a. “smart contracts”.

Weiterlesen