Skip to content

Truffle Box for deploying smart contracts directly to the SKALE Network.

Notifications You must be signed in to change notification settings

kevinbluer/truffle-skale-network-box

 
 

Repository files navigation

SKALE Network Box

box-artwork

Overview

Welcome to the SKALE Network Box! This Truffle SKALE Network box provides you with all the basics necessary to kick-start scaling your application with the SKALE Network. You can find out more information about getting started with SKALE within the Developer Getting Started Guide.

This box comes with everything you need to start using smart contracts from a react app on the SKALE Network.

The SKALE Network is fully decentralized, and is supported by a validator community represented by over 48 validator orgs running over 150 nodes. Since the network is EVM compatible, all existing tools built for Ethereum will work directly within the SKALE Network as well. For example, the SKALE Network is fully compatible with the all Ethereum native wallets. Check out the SKALE Network Dev Portal for easy integration scripts fo connecting your favorite wallet, here.

For example, connecting MetaMask to SKALE in a seamless way can be seen in this document:

https://skale.network/docs/developers/wallets/metamask

All SKALE Chains contain the following features:

  • Full EVM Support for Solidity Smart Contracts
  • Interchain Messaging for managing Tokens (ETH, ERC20, ERC721, etc.)
  • Decentralized Storage
  • Integration Support for All Ethereum Tools
  • Wallet Support for API and HSM Wallets

Lastly, the SKALE Network uses a unique combination of several technologies to achieve scalability, security, interoperability, and progressive decentralization:

Technology Impact
Pooled Validation Proof-of-Stake Scalable security model across validators and delegators
Hybrid Container Architecture Agile allocation of on-demand composable compute resources across the network
Threshold Cryptography Supermajority signature signing with ABBA consensus supports Byzantine Fault Tolerance and resolves data-availability issues
Trusted-Execution Environment Fast block signing and multiple chain support using threshold cryptography
Asynchronous Binary Byzantine Agreement (ABBA) Consensus Mathematically provable, fast-finality, leaderless, and Byzantine Fault Tolerant
Ethereum Network Public, open-source, and decentralized operation of the SKALE Network via SKALE Manager contracts

Requirements

The SKALE Network box has the following requirements:

  • Node.js 12.x or later
  • NPM version 5.2 or later
  • Windows, Linux or MacOS

Installation

$ truffle unbox skale-network
$ npm install

Setup

1) Get a SKALE Chain

The SKALE Network is a multichain platform, and there are many ways to get access to the SKALE Network testing environments. To obtain your SKALE Chain endpoint and Chain ID, check out the SKALE Network getting started guide.

Alternatively, for faster testing please feel free to use the available community SKALE Chains listed here.

2) Get a Wallet

The SKALE Network works with a variety of wallet solutions. If you already have a wallet and private key to use, you can skip this step and go to the next section: Update Truffle Config.

You can pick and setup your favorite wallet from the documentation here.

We recommend starting with MetaMask, and obtaining a wallet address and private key to use for testing from the MetaMask wallet.

Fund your Wallet with skETH

SKALE Chains enable dApps to run gasless transactions. This provides an effective way to scale your dApp not only for speed but also to scale economically. However, SKALE Chains do require skETH to conduct transactions – this skETH is SKALE Chain "fake" ETH with no economic value, but provides a way for dApps to facilitate permissive access to SKALE Chains and protects against DDoS attacks.

You can learn more about skETH here.

If you are using the community SKALE Chains, you can simply head over to the SKALE testnet faucet to obtain skETH for using your SKALE Chain. You will need both your SKALE Chain endpoint and your wallet address to obtain skETH from the faucet.

3) Update Truffle Config

You can add the SKALE Chain endpoint and private key directly into the truffle-config.js file by replacing the following:

const  privateKey = process.env.PRIVATE_KEY;
const  skale = process.env.SKALE_CHAIN;

For example:

const  privateKey = "0x0000000000000000000000000000000000000000000000000000000000000000";
const  skale = "https://this-is-my-skale-chain.com:1234";

A more secure way would be to leave the truffle-config.js as is, and create a .env file at the root directory of your project to hold onto your private key and SKALE Chain endpoint.

Your .env file should look like:

SKALE_CHAIN=https://this-is-my-skale-chain.com:1234 
PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000

To learn more about using environment variables within a .env file plese see:

https://www.npmjs.com/package/dotenv

Deploy to the SKALE Network

You can use Truffle to compile and migrate your smart contracts to the SKALE Network. The following command will compile and migrate the smart contract(s) to SKALE:

truffle migrate --network skale --compile-all

For more information on available Truffle commands, please see the Truffle documentation here:

https://www.trufflesuite.com/docs/truffle/reference/truffle-commands

Testing

Truffle can run tests written in Solidity or JavaScript against your smart contracts. Note the command varies slightly if you're in or outside of the development console.

// inside the truffle development console.
test

// outside the truffle development console.
truffle test

Resources

SKALE Network Resources Links

SKALE Network Community Links

Support

Support for this box is available via the Truffle community here. In addition, SKALE Network support is available here.

About

Truffle Box for deploying smart contracts directly to the SKALE Network.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 57.4%
  • Solidity 42.6%