# How to I interact smart contract through Firblocks

**URL:** <https://community.fireblocks.com/t/how-to-i-interact-smart-contract-through-firblocks/79>\
**Category:** Support\
**Created:** [February 15, 2023, 1:04pm UTC](https://community.fireblocks.com/t/how-to-i-interact-smart-contract-through-firblocks/79 "2023-02-15T13:04:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogevh](https://avatars.discourse-cdn.com/v4/letter/y/f14d63/32.png) [@yogevh](https://community.fireblocks.com/u/yogevh)\
**Post date:** [February 15, 2023, 1:04pm UTC](https://community.fireblocks.com/t/how-to-i-interact-smart-contract-through-firblocks/79/1 "2023-02-15T13:04:54Z")

</div>

Is there a way to interact with the smart contract? As add addreses to a contract, executing a contract etc? I cant find it in the API reference. (it has only basic topic like “create a contract”, “find specific contract”, etc)

---

<div class="post-metadata">

**Author:** ![janlev](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@janlev](https://community.fireblocks.com/u/janlev)\
**Post date:** [February 15, 2023, 1:18pm UTC](https://community.fireblocks.com/t/how-to-i-interact-smart-contract-through-firblocks/79/2 "2023-02-15T13:18:21Z")

</div>

@yogevh  
The first option is to use the [Create Transaction endpoint](https://developers.fireblocks.com/reference/post_transactions) and use make sure the **operation** is CONTRACT\_CALL. That is, assuming you have already built a contract transaction using web3py, web3js or etherJS. You can find a few examples for this here:

You can also review the [Ethereum Development](https://developers.fireblocks.com/docs/ethereum-development) article for interacting with Smart contracts, or the [Ethereum Smart Contract Development](https://developers.fireblocks.com/docs/ethereum-smart-contract-development) article for deploying new contracts.

---

<div class="post-metadata">

**Author:** ![yogevh](https://avatars.discourse-cdn.com/v4/letter/y/f14d63/32.png) [@yogevh](https://community.fireblocks.com/u/yogevh)\
**Post date:** [February 15, 2023, 1:58pm UTC](https://community.fireblocks.com/t/how-to-i-interact-smart-contract-through-firblocks/79/3 "2023-02-15T13:58:15Z")

</div>

Is there any example of how to send a smart contract transaction (to trigger an api inside?) I couldn’t find any in the above.

---

<div class="post-metadata">

**Author:** ![alec](https://sea1.discourse-cdn.com/flex015/user_avatar/community.fireblocks.com/alec/32/112_2.png) [@alec](https://community.fireblocks.com/u/alec)\
**Post date:** [February 15, 2023, 7:47pm UTC](https://community.fireblocks.com/t/how-to-i-interact-smart-contract-through-firblocks/79/4 "2023-02-15T19:47:38Z")

</div>

Hi @yogevh, here’s an example:

```auto
fireblocksApiClient.createTransaction({
    operation: TransactionOperation.CONTRACT_CALL,
    assetId: "ETH",
    source: {
        type: PeerType.VAULT_ACCOUNT,
        id: "0" /* Source Vault Account ID */
    },
    destination: {
        type: PeerType.CONTRACT,
        id: /*externalWalletId here*/
    },
    note: "Contract Call Transaction",
    amount: "0",
    extraParameters: {
        contractCallData: "0x38ed17390000000000000000000000000000000000000000000000000000000bb6c179cc" /* Data Payload */
    }
});

```

The assetId indicates that I want to call a contract on Ethereum.  
The source object indicates that I want to call the contract from my Ethereum address in vault 0.  
The destination object indicates that I want to call a whitelisted contract address.  
You can pass value via the amount field.  
And the payload is passed in extraParameters.contractCallData.

---

<div class="post-metadata">

**Author:** ![SlavaSereb](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@SlavaSereb](https://community.fireblocks.com/u/SlavaSereb)\
**Post date:** [February 15, 2023, 11:06pm UTC](https://community.fireblocks.com/t/how-to-i-interact-smart-contract-through-firblocks/79/5 "2023-02-15T23:06:24Z")

</div>

Hi Yogev,

You can also use our web3 provider with web3.js or ethers.js libraries…  
An example of such usage with web3.js can be found below:

```auto
const { FireblocksWeb3Provider, ChainId } = require("@fireblocks/fireblocks-web3-provider")
const Web3 = require("web3");

const eip1193Provider = new FireblocksWeb3Provider({
    privateKey: "<your_private_key_file_path>",
    apiKey: "<your_api_key>",
    vaultAccountIds: "<vault_account_id/s>",
    chainId: ChainId.GOERLI,
});

(async() => {
    const web3 = new Web3(eip1193Provider);
    const myAddress = await web3.eth.getAccounts()
    const nonce = await web3.eth.getTransactionCount(myAddress[0], 'latest');

    const transaction = {
        'to': 'some_dest_address',
        'value': 101,
        'from': myAddress[0],
        'gas': 30000,
        'maxFeePerGas': 1000000108,
        'nonce': nonce,
       };
    
    const tx = await web3.eth.sendTransaction(transaction, myAddress[0], "")
    console.log(tx)
})();

```
