How to register a smart contract
Use the Orchestrate Gateway API to register smart contracts. Orchestrate supports registration of different versions of the same smart contract. Registering smart contracts is needed for the following purposes:
- Deploy them on-chain.
- Send transactions executing a function of a deployed contract on the Blockchain.
- Decode the events from successful (mined) transactions.
info
Check the REST API Reference or the JS SDK Reference for a detailed description of all endpoints.
Register a smart contract
Register a smart contract using the Orchestrate Gateway API by sending a POST
request to the /contracts
endpoint.
- REST Request
- JavaScript (SDK)
- JSON response
{
"abi": {...},
"bytecode": "0x6080604052348015600f57600080f...",
"deployedBytecode": "0x6080604052348015600f57600080f...",
"name": "ERC20",
"tag": "v1.0.0"
}
import { SimpleToken } from "../artifacts/SimpleToken";
const contract = await client.registerContract({
name: "SimpleToken",
tag: "v1.0.0",
abi: SimpleToken.abi,
bytecode: SimpleToken.bytecode,
deployedBytecode: SimpleToken.deployedBytecode,
});
{
"uuid": "47afcb8c-e8bf-4275-a21d-ae29968e10d8",
"abi": {...},
"bytecode": "0x6080604052348015600f57600080f...",
"deployedBytecode": "0x6080604052348015600f57600080f...",
"name": "ERC20",
"tag": "v1.0.0",
"createdAt": "2020-07-29T03:59:52.783253Z"
}
name
- Name of the contract.tag
- Version of the contract. Specifying a version already registered will overwrite it.abi
- JSON ABI of the contract.bytecode
- Bytecode of the contract.deployedBytecode
- Deployed bytecode of the contract.
info
We recommend using the Truffle Suite to develop smart contracts using Solidity.