Docs - SliceLedger
  • What is Slice Ledger?
  • SliceLedger Key Features
  • SliceLedger Wallet
    • SliceLedger Crypto Wallet
      • Slice Web Extension
    • SliceLedger Explorer
    • SliceLedger DEX
    • SliceLedger NFT Market
  • Sliceledger Chain Network
    • Sliceledger Chain Mainnet
    • Sliceledger Chain Testnet
    • CLI Commands
    • Audit
    • Slice Faucet
  • Integrating Metamask
    • Add SliceLedger Chain Network to Metamask
    • Config Custom Token
    • How to Reset Metamask Wallet
  • Slice Ledger Protocols
    • SLICE Game
    • SLICE Reward
    • SLICE Privacy
  • SliceLedger Exclusive Products
    • Bharat NFT Marketplace
    • Bharat Token
    • Slice Crypto Wallet
    • Slice Wallet Extension
    • Bouquet NFT Collection
  • Enterprise Blockchain
    • Diamond Industry
  • SLICE Token
    • Technical
    • Utility
    • Coin Distribution
  • Developer Guide
    • Token Standards
      • SLICE-20 Tokens
      • SLICE-721 Tokens
    • Verify Smart Contract
  • Masternode
    • Masternode Requirements
    • Masternode Setup Guide
    • Run a Full SliceLedger Node
    • Apply For SliceLedger Masternode
    • Resign as Masternode
  • API
    • accounts
    • blockNumber
    • call
    • chainId
    • estimateGas
    • gasPrice
    • getBalance
    • getBlockByHash
    • getBlockByNumber
    • getBlockTransactionCountByHash
    • getBlockTransactionCountByNumber
    • getCode
    • getLogs
    • getStorageAt
    • getTransactionByBlockHashAndIndex
    • getTransactionByBlockNumberAndIndex
    • getTransactionByHash
    • getTransactionCount
    • getTransactionReceipt
    • getUncleByBlockHashAndIndex
    • getUncleByBlockNumberAndIndex
    • getUncleCountByBlockHash
    • getUncleCountByBlockNumber
    • getWork
    • hashrate
    • mining
    • protocolVersion
    • sendRawTransaction
    • submitWork
    • syncing
    • net_listening
    • net_peerCount
    • net_version
    • web3_clientVersion
    • parity_nextNonce
    • Filter methods
    • newFilter
    • newBlockFilter
    • getFilterChanges
    • uninstallFilter
  • Deploying on SliceLedger Chain
    • Using Remix
    • Using Truffle
    • Using Hardhat
Powered by GitBook
On this page
  • truffle-config
  • Deploying on SliceLedger Chain Network
  1. Deploying on SliceLedger Chain

Using Truffle

PreviousUsing RemixNextUsing Hardhat

Last updated 2 years ago

There are a few technical requirements before we start. Please install the following:

  • (comes with Node)

Once we have those installed, we only need one command to install Truffle:

npm install -g truffle

To verify that Truffle is installed properly, type truffle version on a terminal. If you see an error, make sure that your npm modules are added to your path.

If you're new to Truffle then please follow the by truffle, To setup the truffle environment.

truffle-config

  • Go to truffle-config.js

  • Update the truffle-config with SliceLedger-network-crendentials.

const HDWalletProvider = require('@truffle/hdwallet-provider');
const fs = require('fs');
const mnemonic = fs.readFileSync(".secret").toString().trim();

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
    },
    SliceLedger: {
      provider: () => new HDWalletProvider(mnemonic, `https://test-slice-rpc.com`),
      network_id: 1443,
      confirmations: 2,
      timeoutBlocks: 200,
      skipDryRun: true
    },
  },

  // Set default mocha options here, use special reporters etc.
  mocha: {
    // timeout: 100000
  },

  // Configure your compilers
  compilers: {
    solc: {
    }
  }
}

Notice, it requires mnemonic to be passed in for SliceLedger Chain network, this is the seed phrase for the account you'd like to deploy from. Create a new .secret file in root directory and enter your 12 word mnemonic seed phrase to get started. To get the seedwords from metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words.

Deploying on SliceLedger Chain Network

Run this command in root of the project directory:

$ truffle migrate --network SliceLedger

Contract will be deployed on SliceLedger Testnet, it look like this:

2_deploy_contracts.js
=====================

   Replacing 'MyContract'
   ------------------
   > transaction hash:    0xc921b127afd0ff2e1e5127367dbaa10cb79f019a22749dd651fc339fb361171e
   > Blocks: 10            Seconds: 2
   > contract address:    0xF0B2F5AbE5A52B5BF85B2320A730D1Ed714c1af3
   > block number:        11578
   > block timestamp:     1287126898
   > account:             0x384E2C3a9354EB3590F4e0789c9B800a7456fbe8
   > balance:             5 SLICE
   > gas used:            1896986
   > gas price:           5 gwei
   > value sent:          0 SLICE
   > total cost:          0 SLICE

   Pausing for 2 confirmations...
   ------------------------------
   > confirmation number: 5 (block: 11585)
initialised!

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:                   0 SLICE


Summary
=======
> Total deployments:   3
> Final cost:          0 SLICE

Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.

Congratulations! You have successfully deployed HelloSliceLedger Smart Contract. Now you can interact with the Smart Contract.

Add SLICE to your wallet using

You can check the deployment status here:

Node.js v8+ LTS and npm
Git
Getting Started
https://slicefaucet.io/
https://testnet-slicescan.io/