Skip to content

Retrieving Contract Addresses#

Warning

Developers should never rely on contract addresses gathered from off-chain sources like direct messages, social media, or even websites, as these addresses could easily lead to malicious contracts.

For this reason, this documentation does not provide any contract address except for the single entry point described below. The only secure way to retrieve contract addresses is from the blockchain itself.

As a convenience, though, Flare's smart contract repository contains the latest deployment address for all Flare's smart contracts. These addresses can be used to speed up development, but should not be used in production.

To emphasize: Applications are strongly encouraged to retrieve any contract address they need directly from the blockchain and not have addresses hard-coded into the source code, except for the single entry point given in this page.

Retrieval from Blockchain#

All of Flare's smart contract addresses can be retrieved from the FlareContractRegistry contract. This is the only contract address given in this documentation.

FlareContractRegistry
0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019

This contract is available at the same address in all Flare networks: Flare, Songbird, Coston and Coston2.

Copy the above address into the Block Explorer to see the available contract's methods.

You can retrieve the current address on the blockchain of any Flare smart contract from its name by using these methods, for example:

function getContractAddressByName(
    string calldata _name
) external view returns (
    address);


function getContractAddressesByName(
    string[] calldata _names
) external view returns (
    address[] memory);

The name search is case-sensitive, so you should use the proper capitalization. For example:

Applications can also retrieve all smart contract names and addresses at once using:

function getAllContracts(
) external view returns(
    string[] memory _names,
    address[] memory _addresses);

Retrieval from Source Code#

The Flare Smart Contracts repository contains an autogenerated JSON file listing the latest deployed addresses of all Flare contracts on each network.

You can find this file in the deployment/deploys folder, and parse it to retrieve the addresses of any Flare contract.

Warning

As stated at the beginning, applications should NOT have Flare contract addresses in their source code.

Instead, applications are strongly encouraged to retrieve any contract address they need directly from the blockchain as described above.

Branch JSON file
Flare flare_network_deployed_code flare.json
Songbird songbird_network_deployed_code songbird.json
Coston coston_network_deployed_code coston.json
Coston2 coston2_network_deployed_code coston2.json

Last update: 2024-03-01