Smart Contract
Building Non-Stop
Deploy Smart Contract
Ethereum APIsโ
JSON-RPC Endpointsโ
To interact with C-Chain via the JSON-RPC endpoint:
To interact with other instances of the EVM via the JSON-RPC endpoint:
where blockchainID
is the ID of the blockchain running the EVM.
WebSocket Endpointsโ
To interact via the websocket endpoint:
For example, to interact with the C-Chain's Ethereum APIs via websocket on localhost you can use:
To interact with other instances of the EVM via the websocket endpoint:
where blockchainID
is the ID of the blockchain running the EVM.
Standard Ethereum APIsโ
GEMNODE offers an API interface identical to Geth's API except that it only supports the following services:
web3_
net_
eth_
personal_
txpool_
debug_
(note: this is turned off on the public api node.)
You can interact with these services the same exact way youโd interact with Geth. See the Ethereum Wikiโs JSON-RPC Documentation and Gethโs JSON-RPC Documentation for a full description of this API.
eth_getAssetBalanceโ
In addition to the standard Ethereum APIs, Avalanche offers eth_getAssetBalance
to retrieve the balance of first class Avalanche Native Tokens on the C-Chain (excluding AVAX, which must be fetched with eth_getBalance
).
Signature
address
owner of the assetblk
is the block number or hash at which to retrieve the balanceassetID
id of the asset for which the balance is requested
Example Call
Example Response
eth_baseFeeโ
Get the base fee for the next block.
Signatureโ
result
is the hex value of the base fee for the next block.
Example Callโ
Example Responseโ
eth_maxPriorityFeePerGasโ
Get the priority fee needed to be included in a block.
Signatureโ
result
is hex value of the priority fee needed to be included in a block.
Example Callโ
Example Responseโ
For more information on dynamic fees see the C-Chain section of the transaction fee documentation.
eth_getChainConfigโ
eth_getChainConfig
returns chain config. This API is enabled by default with internal-eth
namespace.
Signature
Example Call
Example Response
GEMNODE Specific APIs
Coming Soon!
Verify Smart Contract
Contract Verificationโ
Smart contract verification provides transparency by publishing the source code, allowing everyone to attest that it really does what it claims to do. You can verify your smart contracts using the GEMNODE Explorer. The procedure is simple:
Navigate to your published contract address on the explorer
On the
code
tab selectverify & publish
Copy and paste the flattened source code and enter all the build parameters exactly as they are on the published contract
Click
verify & publish
If successful, the code
tab will now have a green checkmark, and your users will be able to verify the contents of your contract. This is a strong positive signal that your users can trust your contracts, and it is strongly recommended for all production contracts.
Contract Security Checksโ
Once deployed, it would be tough to fix bugs on decentralized applications due to its nature. Hence, it's vital to ensure an app operates properly before deployment. Contract security reviews can be done by specialized companies and services, but they will be costly. To avoid paying sky high audit fees, developers can use free resources as Slither, MythX, Mythril.
Last updated