Deploying to SKALE is similar to deploying to the Ethereum blockchain. There are a few changes you will need to make within your deployment scripts. When using these code samples, please be sure to modify the code appropriately before running anything in production!
You can share your own code sample by reaching out to us on discord.
Use these deployment script examples to deploy your smart contracts onto your SKALE Chain.
Truffle is a popular way to deploy your smart contracts onto Ethereum, and can also be used to deploy your smart contracts onto SKALE. You can update your truffle configuration file (truffle.js) with a configuration to deploy your smart contracts onto SKALE.
For more information on truffle configuration files, please see Truffle's Configuration Documentation
NOTE: In order to deploy your smart contracts onto SKALE, the transaction needs to be signed. This code below shows how to use the truffle-hdwallet-provider package to sign the transaction with the private key of your wallet.
You can point your deployment scripts for your existing smart contracts to your SKALE Chain’s address and deploy using existing tooling (e.g.: Truffle). An example truffle deployment command to deploy your smart contracts using the 'skale' network in the script above is:
Smart contracts can be deployed with just the use of web3.js as well. Below you will find a simple script for using NodeJS and web3.
NOTE: Web3 and solc versions matter for compatibility. Web3 1.0.0-beta.35 and solc version 0.5.4 work well together, but other version combinations can cause unexpected errors.
For more information on using web3.js, please see Web3.js Getting Started Documentation
See the full code sample on Github
Smart contracts can be deployed using Remix and MetaMask. Follow the steps below to deploy your smart coontracts.
For more information on using remix, please see Remix Documentation
1. Connect to SKALE in MetaMask
To connect SKALE in MetaMask, create a new Custom RPC with your SKALE chain endpoint.