Search code examples
nearprotocol

How to create different account with near dev-deploy?


When I tried to deploy two different contracts with dev-deploy, both contracts were deployed to the same address, there the later erasing the former.

So is there anyway to deploy multiple contracts to different addresses with dev-deploy?


Solution

  • There may be several ways of doing this. The one I tend to do is to delete the files inside the neardev folder:

    • dev-account
    • dev-account.env

    When you delete these, the next time you deploy your contract, it will be given a new address instead of using the existing one.

    Alternative

    An alternative is to create two different accounts beforehand, and deploy to each of them separately by changing accountId.

    near deploy --accountId example-contract.testnet --wasmFile out/example.wasm