In case you have encountered our Bitcoin endpoints, you’ll feel comfortable right away with our Ethereum API as they are both part of distributed public blockchain networks. However, there are a couple of contrasts to be noted between Bitcoin and Ethereum, driven by their usage purposes. While Bitcoin enables online Bitcoin payments through its electronic cash system, Ethereum leads to the building and deployment of dApps.
Whereas the Bitcoin blockchain was purely a list of transactions, Ethereum’s basic unit is the account. The Ethereum blockchain tracks the state of every account, and all state transitions on the Ethereum blockchain are transfers of value and information between accounts. There are two types of accounts:
- Externally Owned Accounts (EOAs), which are controlled by private keys
- Contract Accounts, which are controlled by their contract code and can only be “activated” by an EOA
Crypto APIs Address API allows you to look up information about public Ethereum addresses/accounts and generate your own low-value Ethereum addresses/public-private key pairs. The users doesn’t need to put any information with this POST request for generating addresses.
Our tips on this endpoint:
- The private key returned is immediately discarded by our servers, but we advise that these keys should not be used for any high-value—or long-term storage—addresses.
- Always use HTTPS for Address Generation requests. Otherwise, your generated private keys will be sent over insecure channels and could be MITM’d.
In addition, the returned object will contain a private key in hex-encoded, a public key, and a public address.
Unlike Bitcoin, Ethereum has no concept of UTXOs (check more on our glossary if unfamiliar). Instead, addresses have a running balance, and use an ever-increasing sequence/nonce for every transaction to maintain proper address state. In order to create a transaction, you should have an account(keystore file) stored on our servers, and then provide the from address, to address, value to transfer (in Ether), gas price and gas limit (at least 21,000 wei), nonce(optional) and data(optional). The user should also specify the password associated with the keyfile, in order to unlock the account.
This query will use the addresses within your wallet as the inputs, as if all of them had been placed within the addresses array. Then, the user receives a transaction hash, such as:
It signs the raw transaction with the given parameters and pushes to the Ethereum Blockchain.
Moreover, we provide other endpoints that help provide information if you are not sure whether your gasLimit is enough to make a transaction or what is the average gasPrice,.
Firstly, the concept of contracts represents one of Ethereum’s essential values. The main programming language for building such application is Solidity, which is a decent starting point if you haven’t been creating smart contracts before.
Secondly, The Deploy Smart Contract Endpoint allows you to push your smart contract to the Ethereum Blockchain. You can validate and compile your smart contract to bytecode at the Ethereum official website – Solidity IDE following these steps:
Provide the code by going to Compile
Choose the name of the contract
Go to Details
Go to BYTECODE
Copy the object property (hexadecimal number)
A private key (associated with a funded Ethereum external account), fromAddress, byteCode, gasPrice and gasLimit, to publish, Crypto APIs will embed the contract into the blockchain and return the transaction hash that created the contract.
Finally, The response will be date and hash of the transaction: