Ethereum: Step by step guide to protect your ETH and ETC funds and avoid replay attacks

in crypto •  8 years ago  (edited)

A lot of users would like to trade their ETC but are afraid of replay attacks.

Here I want to provide a simple step by step guide.

(Hint: for lazy ones I recommend OPTION 1)

What is a replay attack?

The Ethereum classic chain (non forked Ethereum chain) and the ETH chain (hard forked Ethereum chain) share the same network layer.

If 'A sends B 1ETH' on the ETH chain, it is therefore possible to send the same transaction 'A sends B 1ETC' on the ETC chain and vice versa.

What are the options to avoid this?

You have to move the funds of an address to seperate addresses for each chain but avoiding a replay attack of these transaction at the same time.
This can be done by contracts that transfer funds to an address depending on if the hard fork happened on the chain or not.
You end up with funds in address A on ETH chain and B on ETC chain.

Basically there are two options.

OPTION 1)

Exchanges that trade ETH and ETC need to avoid these replay attacks as well. Therefore one option is to trust them that they do the fund splitting correctly (in their own interest). If you deposit ETH on poloniex the transaction will be replayed and ETC are also sent to this address. Poloniex detects this and credit you these ETC. You can then trade the ETC and withdraw ETH and ETC to two new different addresses.

Step 1: Generate two addresses.

Lets call them addr_ETH and addr_ETC. 

If you use geth use the command: geth account new or if you use Mist click 'create account'.

Note the address and password for addr_ETH and addr_ETC.

Step 2: Send funds to Poloniex.

Generate an ETH deposit address or use an existing one.

Then send a test transaction (for example 1ETH) to this address.

You should be credited ETH and the same amount of ETC.

If so go ahead and send the rest of the ETH.

Step 3: Trade your ETH and/or ETC if you want

Do normal trading if you like or go on with Step 4

Step 4: Withdraw funds to seperate addresses.

Withdraw ETH funds to addr_ETH.

Withdrae ETC funds to addr_ETC.

Step 5: Done :)

You have successfully splitted your fund in two seperate addresses which are safe against replay attacks since they exist only on one chain.

OPTION 2) This option use a contract written by Vitalik Buterin in order to transfer your funds under the condition that the hard fork happened or not happened.

Some contract info:

The contract address is:

0xb671c3883307cf05bb3dff77a9754e87b4347195

Contract ABI:

[{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"transferIfHF","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"transferIfNoHF","outputs":[],"type":"function"}]

Step 0: Setup if you used the 'hard fork chain before' and/or Mist before.

NOTE: If you used the option to support the hard fork in Mist before, go to:

Mac: ~/Library/Ethereum

Linux: ~/.ethereum

Windows: %APPDATA%\Ethereum

and move everything except the 'keystore' folder to a new folder 'blockchainHF'

Then go to blockchain data folder:

Mac: ~/Library/Application Support/Mist/"

Linux: ~/.config/Mist

Windows: C:\Users< Your Username >\AppData\Roaming

and rename the Mist folder to 'MistHF':

Step 1: Download the newest version of Mist (0.8.1):

https://github.com/ethereum/mist/releases

Step 2: Start Mist and select 'No'

Step 3: Wait until synced.

Step 4: Create a new account.

Click 'ADD ACCOUNT'.

Note the password.

Note the address.

Lets call this address 'addr_ETC'.

Step 5: Watch the contract.

Click 'CONTRACTS'.

Click 'WATCH CONTRACT'

Give it the name 'HFConditionalTransfer'.

Paste the contract address in the 'CONTRACT ADDRESS' field: 

0xb671c3883307cf05bb3dff77a9754e87b4347195

Paste the contract ABI in the 'JSON INTERFACE' field: 

[{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"transferIfHF","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"transferIfNoHF","outputs":[],"type":"function"}]

Click OK.

Step 6: Transfer the ETH funds to addr_ETC.

Click 'CONTRACTS'.

Click on the contract 'HFConditionalTransfer'.

At the right side you see 'WRITE TO CONTRACT'.

Select the function 'Transfer If No HF'.

Paste in addr_ETC in the 'TO-address' field.

Let's do a test transaction first and type in 0.1 in the 'Send ETHER' field.

Click 'EXECUTE'.

Type in your password.

Step 7: Check if transfer was successful.

Click 'WALLETS'.

Wait a bit and see if the contract execution gets confirmed.

After confirmation check the balance of addr_ETC.

If it is 0.1 go ahead.

Step 8: Send the rest of your balance.

Do the process of Step 7 again but take the total balance (a little less for the fees) this time.

Step 9: Check the balance

Go to 'WALLETS' and check the balance of addr_ETC.

If it is now the full balance you have transfered your funds successfully on the non hard fork chain to an safe address.

Step 10: Do same trading with ETC or whatever you like to do with your ETC

If you want to be super safe you do the same procedure on the hard fork chain again and send it to an new address addr_ETH:

Step 11: Do it all over again :)

Start with Step 0.

In the blockchain data folder move all folders except blockchainHF to blockchainNonHF. Move all content from the blockchainHF folder in this blockchain data folder.

Then rename the 'Mist' folder in MistNonHF and the MistHF into Mist.

Skip Step 1.

In Step 2 select 'YES'.

Do Step 3.

In Step 4 generate a new address addr_ETH.

Do Step 5.

In Step 6 select 'Transfer If HF' and send to addr_ETH.

Do Step 7-9 with addr_ETH.

Step 10: Enjoy sending, trading, using your ETH. :)

If I missed something please leave a comment below.

#ethereum #ether #eth #etc #ethereumclassic #crypto #cryptocurrency #cryptonews #blockchain #relay #replay #hardfork #hf

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!