I recently learnt that it is possible to deploy more than one smart contract into the network. This brings the question, can they and how do these smart contracts interact? All the online courses I've covered so far handle deploying one smart contract only.


Any smart contract can interact with any other smart contract (unless it's somehow restricted in code). All you need is:

  1. The address of the other contract

  2. Knowledge of the other contract's functionality you want to access. Typically this is provided as an interface.

Here's a minimal example on how to interact with another contract which is already deployed in the blockchain:

pragma solidity ^0.7.0;

interface IOtherContr {
    function doStuff(uint256 some) external;

contract Test {
    function doSomething(address otherContr) public {
        IOtherContr ref = IOtherContr(otherContr);

If, however, you wish to create a new instance of a contract (instead of referencing an existing one) you can use the new keyword, but then you need the full implementation of the other contract and it will create a new contract in a new address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.