freeradiantbunny.org

freeradiantbunny.org/blog

flare network api

To interact with an ERC-20 token on the Flare Network, the ABI (Application Binary Interface) remains consistent with the standard ERC-20 specification. The Flare Network is compatible with Ethereum's tools and standards, meaning you can use the ERC-20 ABI for contracts deployed on Flare in the same way you would for Ethereum or any other EVM-based chain.

Here's the standard ERC-20 ABI:

json
                                                                  [
                                                                  {
                                                                  "constant": true,
                                                                  "inputs": [],
                                                                  "name": "name",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "string"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "view",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "constant": true,
                                                                  "inputs": [],
                                                                  "name": "symbol",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "string"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "view",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "constant": true,
                                                                  "inputs": [],
                                                                  "name": "decimals",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "uint8"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "view",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "constant": true,
                                                                  "inputs": [
                                                                  {
                                                                  "name": "owner",
                                                                  "type": "address"
                                                                  }
                                                                  ],
                                                                  "name": "balanceOf",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "uint256"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "view",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "constant": true,
                                                                  "inputs": [],
                                                                  "name": "totalSupply",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "uint256"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "view",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "constant": true,
                                                                  "inputs": [
                                                                  {
                                                                  "name": "owner",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "name": "spender",
                                                                  "type": "address"
                                                                  }
                                                                  ],
                                                                  "name": "allowance",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "uint256"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "view",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "inputs": [
                                                                  {
                                                                  "name": "spender",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "name": "amount",
                                                                  "type": "uint256"
                                                                  }
                                                                  ],
                                                                  "name": "approve",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "bool"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "nonpayable",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "inputs": [
                                                                  {
                                                                  "name": "to",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "name": "amount",
                                                                  "type": "uint256"
                                                                  }
                                                                  ],
                                                                  "name": "transfer",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "bool"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "nonpayable",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "inputs": [
                                                                  {
                                                                  "name": "from",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "name": "to",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "name": "amount",
                                                                  "type": "uint256"
                                                                  }
                                                                  ],
                                                                  "name": "transferFrom",
                                                                  "outputs": [
                                                                  {
                                                                  "name": "",
                                                                  "type": "bool"
                                                                  }
                                                                  ],
                                                                  "payable": false,
                                                                  "stateMutability": "nonpayable",
                                                                  "type": "function"
                                                                  },
                                                                  {
                                                                  "anonymous": true,
                                                                  "inputs": [
                                                                  {
                                                                  "indexed": true,
                                                                  "name": "owner",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "indexed": true,
                                                                  "name": "spender",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "name": "value",
                                                                  "type": "uint256"
                                                                  }
                                                                  ],
                                                                  "name": "Approval",
                                                                  "type": "event"
                                                                  },
                                                                  {
                                                                  "anonymous": true,
                                                                  "inputs": [
                                                                  {
                                                                  "indexed": true,
                                                                  "name": "from",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "indexed": true,
                                                                  "name": "to",
                                                                  "type": "address"
                                                                  },
                                                                  {
                                                                  "name": "value",
                                                                  "type": "uint256"
                                                                  }
                                                                  ],
                                                                  "name": "Transfer",
                                                                  "type": "event"
                                                                  }
                                                                  ]
                                                                  ```
                                                                  

Method Allow List

The following methods provide various levels of access to the Flare Network's Ethereum-compatible services, ranging from general public API calls (public-eth, web3) to more internal-focused endpoints (internal-public-eth, internal-public-transaction-pool) that may be used for maintenance or administration. The methods are specific API methods that are accessible to users based on their API key's permissions.

The method allow list refers to a predefined list of allowed API methods or endpoints that a user can access using their API key. When a system administrator attempts to access the Flare Network API, the key they use will be subject to this "allowlist," meaning only methods explicitly granted to that key are accessible. This is a way of controlling access to different network functionalities, ensuring security and managing which methods are available to users.

Here is a breakdown of each term:

1. public-eth: This refers to public-facing Ethereum-compatible JSON-RPC API methods that allow the user to interact with the Flare Network's Ethereum-compatible blockchain. Typically, this would cover actions like querying the state of the blockchain, sending transactions, or interacting with smart contracts. It's essentially a gateway for developers to interact with the public network.

2. public-eth-filter: This is an API method related to Ethereum filters, which allows users to monitor the blockchain for certain events or changes. For example, a developer might want to listen for new blocks or specific transactions. This method allows filtering logs, transactions, and events without polling the entire network for changes, making it more efficient.

3. net: This API method is used to interact with network-related functionality. It typically includes basic networking details such as the current network ID, whether the node is connected, or what the peer count is. This is useful for checking the health of the network or troubleshooting connectivity issues.

4. web3: This is a core API for interacting with an Ethereum-based network, providing functions for sending transactions, reading data from smart contracts, and accessing network state. The web3 methods provide a high-level interface for developers to build decentralized applications (dApps) on top of the network. Essentially, it is the primary way developers interact with the blockchain programmatically.

5. internal-public-eth: This method likely refers to the internal-facing Ethereum API methods exposed by the Flare Network. These might include internal operations that are necessary for the blockchain’s functioning but are not directly exposed to the general public. Access to this method could be restricted to system administrators or trusted entities, ensuring more sensitive operations or data are protected.

6. internal-public-blockchain: Similar to internal-public-eth, this API endpoint likely deals with blockchain-specific functions, such as retrieving information about the blockchain’s internal state or performing operations like syncing the blockchain, managing its state, or querying for block-related data. These methods may be used for network maintenance or administration.

7. internal-public-transaction-pool: This refers to the transaction pool, a temporary storage area for transactions that have been broadcast to the network but have not yet been included in a block. The transaction-pool methods allow internal users to query and manage the transaction pool, such as retrieving pending transactions or analyzing the pool's state. This is important for network administrators or systems monitoring to ensure transactions are being processed correctly.


See: Flare Network

See: api