Skip to content

Deploy a Contract

To interact with a smart contract through FSCO, you’ll first need to deploy it by uploading the contract ABI and registering the deployment. This guide walks you through that two-step process.

Before you begin, ensure you have:

  • A valid FSCO API key
  • Your compiled contract’s ABI (JSON)
  • The contract already deployed on-chain
POST /v2/contract/abi
{
"name": "MyContract",
"abi": [/* ... ABI JSON ... */],
"interfaceTypes": ["ERC20"],
"isShared": true
}

The request requires:

  • name: The name of the contract
  • abi: The ABI of the contract
  • interfaceTypes: The types of interfaces the contract implements
  • isShared: Whether this ABI should be available across environments
upload-abi.sh
curl -X POST https://api.fsco.io/v2/contract/abi \
-H "Authorization: Bearer $FSCO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "MyContract",
"abi": [
{
"type": "function",
"name": "balanceOf",
"inputs": [
{
"name": "account",
"type": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"stateMutability": "view"
}
],
"interfaceTypes": ["ERC20"],
"isShared": true
}'
response.json
{
"queryId": "{{queryId UUID string}}"
}

POST /v2/contract/deployment

{
"name": "MyContractDeployment",
"chainId": "13337",
"contractAddress": "0xabc123...",
"abiId": "your-uploaded-abi-id",
"isShared": true
}

The request requires:

  • name: Name for this specific deployment
  • chainId: The actual chainId of the EVM chain the contract is deployed to
  • contractAddress: The address the contract is deployed to
  • abiId: The ID from the upload step
  • isShared: Whether to make this available across environments
register-deployment.sh
curl -X POST https://api.fsco.io/v2/contract/deployment \
-H "Authorization: Bearer $FSCO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"referenceId": "MyContractDeployment",
"chainId": "13337",
"contractAddress": "0xabc123456789abcdef123456789abcdef1234567",
"abiId": "123e4567-e89b-12d3-a456-426614174000",
"isShared": true
}'
  • Both ABI and Deployment must be registered before calling or querying methods
  • Use meaningful names so you can easily find and reuse these resources later
  • Shared ABIs and deployments are visible across environments (e.g. staging, production)