/ truffle-config.js
truffle-config.js
1 /** 2 * Use this file to configure your truffle project. It's seeded with some 3 * common settings for different networks and features like migrations, 4 * compilation, and testing. Uncomment the ones you need or modify 5 * them to suit your project as necessary. 6 * 7 * More information about configuration can be found at: 8 * 9 * https://trufflesuite.com/docs/truffle/reference/configuration 10 * 11 * Hands-off deployment with Infura 12 * -------------------------------- 13 * 14 * Do you have a complex application that requires lots of transactions to deploy? 15 * Use this approach to make deployment a breeze ๐๏ธ: 16 * 17 * Infura deployment needs a wallet provider (like @truffle/hdwallet-provider) 18 * to sign transactions before they're sent to a remote public node. 19 * Infura accounts are available for free at ๐: https://infura.io/register 20 * 21 * You'll need a mnemonic - the twelve word phrase the wallet uses to generate 22 * public/private key pairs. You can store your secrets ๐ค in a .env file. 23 * In your project root, run `$ npm install dotenv`. 24 * Create .env (which should be .gitignored) and declare your MNEMONIC 25 * and Infura PROJECT_ID variables inside. 26 * For example, your .env file will have the following structure: 27 * 28 * MNEMONIC = <Your 12 phrase mnemonic> 29 * PROJECT_ID = <Your Infura project id> 30 * 31 * Deployment with Truffle Dashboard (Recommended for best security practice) 32 * -------------------------------------------------------------------------- 33 * 34 * Are you concerned about security and minimizing rekt status ๐ค? 35 * Use this method for best security: 36 * 37 * Truffle Dashboard lets you review transactions in detail, and leverages 38 * MetaMask for signing, so there's no need to copy-paste your mnemonic. 39 * More details can be found at ๐: 40 * 41 * https://trufflesuite.com/docs/truffle/getting-started/using-the-truffle-dashboard/ 42 */ 43 44 // require('dotenv').config(); 45 // const { MNEMONIC, PROJECT_ID } = process.env; 46 47 // const HDWalletProvider = require('@truffle/hdwallet-provider'); 48 49 module.exports = { 50 /** 51 * Networks define how you connect to your ethereum client and let you set the 52 * defaults web3 uses to send transactions. If you don't specify one truffle 53 * will spin up a managed Ganache instance for you on port 9545 when you 54 * run `develop` or `test`. You can ask a truffle command to use a specific 55 * network from the command line, e.g 56 * 57 * $ truffle test --network <network-name> 58 */ 59 60 networks: { 61 // Useful for testing. The `development` name is special - truffle uses it by default 62 // if it's defined here and no other network is specified at the command line. 63 // You should run a client (like ganache, geth, or parity) in a separate terminal 64 // tab if you use this network and you must also set the `host`, `port` and `network_id` 65 // options below to some value. 66 // 67 // development: { 68 // host: "127.0.0.1", // Localhost (default: none) 69 // port: 8545, // Standard Ethereum port (default: none) 70 // network_id: "*", // Any network (default: none) 71 // }, 72 // 73 // An additional network, but with some advanced optionsโฆ 74 // advanced: { 75 // port: 8777, // Custom port 76 // network_id: 1342, // Custom network 77 // gas: 8500000, // Gas sent with each transaction (default: ~6700000) 78 // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) 79 // from: <address>, // Account to send transactions from (default: accounts[0]) 80 // websocket: true // Enable EventEmitter interface for web3 (default: false) 81 // }, 82 // 83 // Useful for deploying to a public network. 84 // Note: It's important to wrap the provider as a function to ensure truffle uses a new provider every time. 85 // goerli: { 86 // provider: () => new HDWalletProvider(MNEMONIC, `https://goerli.infura.io/v3/${PROJECT_ID}`), 87 // network_id: 5, // Goerli's id 88 // confirmations: 2, // # of confirmations to wait between deployments. (default: 0) 89 // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) 90 // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) 91 // }, 92 // 93 // Useful for private networks 94 // private: { 95 // provider: () => new HDWalletProvider(MNEMONIC, `https://network.io`), 96 // network_id: 2111, // This network is yours, in the cloud. 97 // production: true // Treats this network as if it was a public net. (default: false) 98 // } 99 }, 100 101 // Set default mocha options here, use special reporters, etc. 102 mocha: { 103 // timeout: 100000 104 }, 105 106 // Configure your compilers 107 compilers: { 108 solc: { 109 version: "0.8.21", // Fetch exact version from solc-bin (default: truffle's version) 110 // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) 111 // settings: { // See the solidity docs for advice about optimization and evmVersion 112 // optimizer: { 113 // enabled: false, 114 // runs: 200 115 // }, 116 // evmVersion: "byzantium" 117 // } 118 } 119 }, 120 121 // Truffle DB is currently disabled by default; to enable it, change enabled: 122 // false to enabled: true. The default storage location can also be 123 // overridden by specifying the adapter settings, as shown in the commented code below. 124 // 125 // NOTE: It is not possible to migrate your contracts to truffle DB and you should 126 // make a backup of your artifacts to a safe location before enabling this feature. 127 // 128 // After you backed up your artifacts you can utilize db by running migrate as follows: 129 // $ truffle migrate --reset --compile-all 130 // 131 // db: { 132 // enabled: false, 133 // host: "127.0.0.1", 134 // adapter: { 135 // name: "indexeddb", 136 // settings: { 137 // directory: ".db" 138 // } 139 // } 140 // } 141 };