Ethereum Classic API and its usage

Ethereum Classic API

What is Ethereum Classic?

Crypto APIs focuses on Ethereum Classic API as one of its features. Ethereum Classic is a blockchain, crypto, and community.

Its crypto price is at $9.39, with a market cap of $1.10 billion at the moment of writing. The value token is Ether, the same as Ethereum.

As a blockchain, it is derived from a hard fork of Ethereum.

Why does Ethereum Classic exist?

Initially, the hard fork of Ethereum happened in 2016. It followed the DAO attack and was offered as a solution to the vulnerabilities. In simple words, DAOs were complex smart contracts that ran on Ethereum. The purpose of the DAO contracts was to run VC funds in the name of dApps. Logically, these were incentives for the community that created those applications based on Ethereum ecosystem.

Eventually, there was a loophole in the DAO that made possible the exploitation of hacking of around $50 million dollars. Thus, this is where the “battle of ethics and ideology” started within the community. There were three choices of action that could be done: nothing, soft fork or hard fork. The majority (including founders) agreed on updating the blockchain through a hard fork, which resulted in reversing the attack and gaining back the funds.

However, Ethereum Classic community does believe nothing should’ve been done. Consequently, they stick to the first version. This represents the philosophy of Ethereum code not being mutable. As they say: “Code is Law”.

In addition, there are several features of ETC similar to ETH. For instance:

  • Firstly, Ethereum Classic has no concept of UTXOs (check more on our glossary if unfamiliar). It works only with “accounts”.
  • Secondly, in order for the transaction to be added in the block, it would take about 15 seconds as opposed to 2.5 minutes (Litecoin) or 10 minutes (Bitcoin).
  • Thirdly, miners get rewards for including references to orphan blocks (so-called “uncle blocks”).
  • Lastly, transactions cost “gas” to run (denominated in ether) depending on how computationally expensive they are to run. Blocks also have total gas limits to prevent runaway computation/keep the network decentralized.

Finally, Crypto APIs provides Ethereum Classic API endpoints on interacting with this unforked version of Ethereum blockchain.

Crypto API – Ethereum Classic API

Ethereum Classic API – Tokens

Crypto APIs Token API allows you to get token balances of addresses, and transfer tokens from one address to another.

Transfer Tokes

For instance:

curl -X POST https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer \-H ‘Content-Type: application/json’ \-H ‘X-API-Key: my-api-key’-d ‘{
fromAddress” : “0x0cb1883c01377f45ee5d7448a32b5ac1709afc11”,
toAddress” : “0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8”,
contract” : “0xe7d553c3aab5943ec097d60535fd06f1b75db43e”,
password“: “abc123456” or “privateKey” :
0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed”,
gasPrice” : 11500000000,
gasLimit” : 60000,
“token” : 115,
“nonce”: 179
}’

This POST request allows the transfer from one address to another, using these parameters:

  • from Address
  • to Address
  • the private key or password (if it is an account stored on Crypto API servers),
  • the contract address that created the tokens
  • amount of tokens you would like to transfer
  • gas price (21000000000 wei by default)
  • gas limit (100000 wei by default)
  • nonce which is the transactions count for the specified from address. If not specified, the system will automatically calculate the correct nonce

Ethereum Classic API – Payment Forwarding

Payment Forwarding is an automatic way to move any received funds to another wallet. It’s mainly used to move funds once received to cold wallets. Moving funds from hot wallets to cold wallets is a common practice in the market, it’s used by all exchanges and wallets. Additionally, Crypto APIs will monitor the wallet/address you have a subscription for. Instantly, once any funds are received, Crypto APIs will move them to the target wallet/address then notify you by sending a call to the URL you have specified.

Address stored in Crypto APIs servers

If you have a Keystore file/account created on Crypto APIs servers you need to provide the following information:

  • from address
  • to address
  • callback
  • password
  • confirmations – after how many confirmations to execute the payment forwarding
  • gasPrice (Optional)
  • gasLimit (Optional)

Address not stored in Crypto APIs servers

Here is how to create an automated payment forwarding for an address that is not stored on our servers. Firstly, the user should prove the following information:

  • from address
  • to address
  • callback
  • password
  • confirmations – after how many confirmations to execute the payment forwarding
  • gasPrice (Optional)
  • gasLimit (Optional)

Note: We suggest confirmations to be set to at least 6.

After executing the forwarding payment, a message goes the specified callback(URL). For instance:

{ “currency“: “ETH”,
network“: “rinkeby”,
type“: “PAYMENT_FORWARDING”,
uuid“: “238c883e-f560-4297-949d-b3f45f01dbee”,
txHash“:
“0xc8019576c5b8140476d28217db711bb9bc642216071b7186d7abd7a97954cfcb”,
url” : “http://myaddress.com/paymet_forwarding_hook”,
status“: “DONE”,
message“: “Payment forwarding was successful!”
}

In a nutshell, these are a few examples of how endpoints help in integrating the Ethereum API into your website. They provide the backbone into the complete process of building, deploying dApps and much more.

Read more about Ethereum Classic API on our docs.