Truffle in production it´s recommended [closed]












2














It´s recommended to use the truffle framework for production?? Or just to develop purpose??



I mean can I connect my truffle to my private blockchain and execute the compile/migrate commands without hesitation. Or it´s better to do this without truffle??










share|improve this question















closed as primarily opinion-based by Ismael, Achala Dissanayake, shane, flygoing, Aniket Nov 30 '18 at 12:37


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.




















    2














    It´s recommended to use the truffle framework for production?? Or just to develop purpose??



    I mean can I connect my truffle to my private blockchain and execute the compile/migrate commands without hesitation. Or it´s better to do this without truffle??










    share|improve this question















    closed as primarily opinion-based by Ismael, Achala Dissanayake, shane, flygoing, Aniket Nov 30 '18 at 12:37


    Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.


















      2












      2








      2


      1





      It´s recommended to use the truffle framework for production?? Or just to develop purpose??



      I mean can I connect my truffle to my private blockchain and execute the compile/migrate commands without hesitation. Or it´s better to do this without truffle??










      share|improve this question















      It´s recommended to use the truffle framework for production?? Or just to develop purpose??



      I mean can I connect my truffle to my private blockchain and execute the compile/migrate commands without hesitation. Or it´s better to do this without truffle??







      truffle






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 27 '18 at 9:47







      Eduardo

















      asked Nov 27 '18 at 9:35









      EduardoEduardo

      2008




      2008




      closed as primarily opinion-based by Ismael, Achala Dissanayake, shane, flygoing, Aniket Nov 30 '18 at 12:37


      Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.






      closed as primarily opinion-based by Ismael, Achala Dissanayake, shane, flygoing, Aniket Nov 30 '18 at 12:37


      Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
























          2 Answers
          2






          active

          oldest

          votes


















          2














          Yes, but...



          I've found Truffle's deployment-syntax to be very cumbersome, and ended up implementing my own deployment code (though I still run it via truffle deploy or truffle migrate).



          Here is an example:



          let ARG1 = process.argv[4];
          let ARG2 = process.argv[5];
          let ARG3 = process.argv[6];

          async function deploy(contractName, contractArgs = ) {
          let handle = await artifacts.require(contractName).new(...contractArgs);
          console.log(`${contractName} contract deployed at address ${handle.address}`);
          return handle;
          }

          async function execute() {
          let contract1 = await deploy("Contract1", [ARG1, ARG2]);
          let contract2 = await deploy("Contract2");
          let contract3 = await deploy("Contract3", [ARG3, contract1.address, contract2.address]);
          }

          async function measure() {
          let gasPrice = web3.eth.gasPrice;
          let bgnBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          await execute();
          let endBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          console.log(`Total cost: ${bgnBalance.minus(endBalance).div(gasPrice)} gas units`);
          }

          module.exports = function(deployer, network, accounts) {
          if (network == "production")
          deployer.then(async function() {await measure();});
          };


          Then calling:



          truffle deploy --network=production 0x123 0x456 0x789


          Of course, you'll need to add the production network in your truffle-config.js file, for example:



          networks: {
          development: {
          host: "127.0.0.1",
          port: 8545,
          network_id: "*",
          gasPrice: 0x1,
          gas: 0x1fffffffffffff
          },
          production: {
          host: ...,
          port: ...,
          network_id: ...,
          gasPrice: 100000000000,
          gas: 6721975
          }
          }





          share|improve this answer























          • Sorry but I can´t undestand the purpose of your code. 0x123 0x456 0x789 values what mean? The rest I undestand and it result me very usefull. Concrectly truffle-config.js production part.
            – Eduardo
            Nov 27 '18 at 11:51










          • @Eduardo: They go into ARG1, ARG2 and ARG3. This is useful if you need to pass inputs arguments to constructors.
            – goodvibration
            Nov 27 '18 at 13:12












          • Yes, but I mean what is the purpose with this js file?? 0x123 0x456 0x789 what represent?
            – Eduardo
            Nov 27 '18 at 13:49










          • @Eduardo: It's an example of how you pass arguments when you call truffle deploy!!!
            – goodvibration
            Nov 27 '18 at 14:24



















          2














          I think at this stage of Ethereum (4 years old) and Truffle (3 years old), we can definitely recommend the Truffle suite to deploy contracts safely anywhere. It's a trusted software recognized by the entire Ethereum community.



          However, it doesn't make your private key safe or anything like that. You are responsible for the security of your private keys used to deploy those contracts.






          share|improve this answer





















          • Understand thx for the info ;D
            – Eduardo
            Nov 27 '18 at 11:47


















          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          Yes, but...



          I've found Truffle's deployment-syntax to be very cumbersome, and ended up implementing my own deployment code (though I still run it via truffle deploy or truffle migrate).



          Here is an example:



          let ARG1 = process.argv[4];
          let ARG2 = process.argv[5];
          let ARG3 = process.argv[6];

          async function deploy(contractName, contractArgs = ) {
          let handle = await artifacts.require(contractName).new(...contractArgs);
          console.log(`${contractName} contract deployed at address ${handle.address}`);
          return handle;
          }

          async function execute() {
          let contract1 = await deploy("Contract1", [ARG1, ARG2]);
          let contract2 = await deploy("Contract2");
          let contract3 = await deploy("Contract3", [ARG3, contract1.address, contract2.address]);
          }

          async function measure() {
          let gasPrice = web3.eth.gasPrice;
          let bgnBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          await execute();
          let endBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          console.log(`Total cost: ${bgnBalance.minus(endBalance).div(gasPrice)} gas units`);
          }

          module.exports = function(deployer, network, accounts) {
          if (network == "production")
          deployer.then(async function() {await measure();});
          };


          Then calling:



          truffle deploy --network=production 0x123 0x456 0x789


          Of course, you'll need to add the production network in your truffle-config.js file, for example:



          networks: {
          development: {
          host: "127.0.0.1",
          port: 8545,
          network_id: "*",
          gasPrice: 0x1,
          gas: 0x1fffffffffffff
          },
          production: {
          host: ...,
          port: ...,
          network_id: ...,
          gasPrice: 100000000000,
          gas: 6721975
          }
          }





          share|improve this answer























          • Sorry but I can´t undestand the purpose of your code. 0x123 0x456 0x789 values what mean? The rest I undestand and it result me very usefull. Concrectly truffle-config.js production part.
            – Eduardo
            Nov 27 '18 at 11:51










          • @Eduardo: They go into ARG1, ARG2 and ARG3. This is useful if you need to pass inputs arguments to constructors.
            – goodvibration
            Nov 27 '18 at 13:12












          • Yes, but I mean what is the purpose with this js file?? 0x123 0x456 0x789 what represent?
            – Eduardo
            Nov 27 '18 at 13:49










          • @Eduardo: It's an example of how you pass arguments when you call truffle deploy!!!
            – goodvibration
            Nov 27 '18 at 14:24
















          2














          Yes, but...



          I've found Truffle's deployment-syntax to be very cumbersome, and ended up implementing my own deployment code (though I still run it via truffle deploy or truffle migrate).



          Here is an example:



          let ARG1 = process.argv[4];
          let ARG2 = process.argv[5];
          let ARG3 = process.argv[6];

          async function deploy(contractName, contractArgs = ) {
          let handle = await artifacts.require(contractName).new(...contractArgs);
          console.log(`${contractName} contract deployed at address ${handle.address}`);
          return handle;
          }

          async function execute() {
          let contract1 = await deploy("Contract1", [ARG1, ARG2]);
          let contract2 = await deploy("Contract2");
          let contract3 = await deploy("Contract3", [ARG3, contract1.address, contract2.address]);
          }

          async function measure() {
          let gasPrice = web3.eth.gasPrice;
          let bgnBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          await execute();
          let endBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          console.log(`Total cost: ${bgnBalance.minus(endBalance).div(gasPrice)} gas units`);
          }

          module.exports = function(deployer, network, accounts) {
          if (network == "production")
          deployer.then(async function() {await measure();});
          };


          Then calling:



          truffle deploy --network=production 0x123 0x456 0x789


          Of course, you'll need to add the production network in your truffle-config.js file, for example:



          networks: {
          development: {
          host: "127.0.0.1",
          port: 8545,
          network_id: "*",
          gasPrice: 0x1,
          gas: 0x1fffffffffffff
          },
          production: {
          host: ...,
          port: ...,
          network_id: ...,
          gasPrice: 100000000000,
          gas: 6721975
          }
          }





          share|improve this answer























          • Sorry but I can´t undestand the purpose of your code. 0x123 0x456 0x789 values what mean? The rest I undestand and it result me very usefull. Concrectly truffle-config.js production part.
            – Eduardo
            Nov 27 '18 at 11:51










          • @Eduardo: They go into ARG1, ARG2 and ARG3. This is useful if you need to pass inputs arguments to constructors.
            – goodvibration
            Nov 27 '18 at 13:12












          • Yes, but I mean what is the purpose with this js file?? 0x123 0x456 0x789 what represent?
            – Eduardo
            Nov 27 '18 at 13:49










          • @Eduardo: It's an example of how you pass arguments when you call truffle deploy!!!
            – goodvibration
            Nov 27 '18 at 14:24














          2












          2








          2






          Yes, but...



          I've found Truffle's deployment-syntax to be very cumbersome, and ended up implementing my own deployment code (though I still run it via truffle deploy or truffle migrate).



          Here is an example:



          let ARG1 = process.argv[4];
          let ARG2 = process.argv[5];
          let ARG3 = process.argv[6];

          async function deploy(contractName, contractArgs = ) {
          let handle = await artifacts.require(contractName).new(...contractArgs);
          console.log(`${contractName} contract deployed at address ${handle.address}`);
          return handle;
          }

          async function execute() {
          let contract1 = await deploy("Contract1", [ARG1, ARG2]);
          let contract2 = await deploy("Contract2");
          let contract3 = await deploy("Contract3", [ARG3, contract1.address, contract2.address]);
          }

          async function measure() {
          let gasPrice = web3.eth.gasPrice;
          let bgnBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          await execute();
          let endBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          console.log(`Total cost: ${bgnBalance.minus(endBalance).div(gasPrice)} gas units`);
          }

          module.exports = function(deployer, network, accounts) {
          if (network == "production")
          deployer.then(async function() {await measure();});
          };


          Then calling:



          truffle deploy --network=production 0x123 0x456 0x789


          Of course, you'll need to add the production network in your truffle-config.js file, for example:



          networks: {
          development: {
          host: "127.0.0.1",
          port: 8545,
          network_id: "*",
          gasPrice: 0x1,
          gas: 0x1fffffffffffff
          },
          production: {
          host: ...,
          port: ...,
          network_id: ...,
          gasPrice: 100000000000,
          gas: 6721975
          }
          }





          share|improve this answer














          Yes, but...



          I've found Truffle's deployment-syntax to be very cumbersome, and ended up implementing my own deployment code (though I still run it via truffle deploy or truffle migrate).



          Here is an example:



          let ARG1 = process.argv[4];
          let ARG2 = process.argv[5];
          let ARG3 = process.argv[6];

          async function deploy(contractName, contractArgs = ) {
          let handle = await artifacts.require(contractName).new(...contractArgs);
          console.log(`${contractName} contract deployed at address ${handle.address}`);
          return handle;
          }

          async function execute() {
          let contract1 = await deploy("Contract1", [ARG1, ARG2]);
          let contract2 = await deploy("Contract2");
          let contract3 = await deploy("Contract3", [ARG3, contract1.address, contract2.address]);
          }

          async function measure() {
          let gasPrice = web3.eth.gasPrice;
          let bgnBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          await execute();
          let endBalance = web3.eth.getBalance(web3.eth.accounts[0]);
          console.log(`Total cost: ${bgnBalance.minus(endBalance).div(gasPrice)} gas units`);
          }

          module.exports = function(deployer, network, accounts) {
          if (network == "production")
          deployer.then(async function() {await measure();});
          };


          Then calling:



          truffle deploy --network=production 0x123 0x456 0x789


          Of course, you'll need to add the production network in your truffle-config.js file, for example:



          networks: {
          development: {
          host: "127.0.0.1",
          port: 8545,
          network_id: "*",
          gasPrice: 0x1,
          gas: 0x1fffffffffffff
          },
          production: {
          host: ...,
          port: ...,
          network_id: ...,
          gasPrice: 100000000000,
          gas: 6721975
          }
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 4 '18 at 21:04

























          answered Nov 27 '18 at 10:08









          goodvibrationgoodvibration

          2,957821




          2,957821












          • Sorry but I can´t undestand the purpose of your code. 0x123 0x456 0x789 values what mean? The rest I undestand and it result me very usefull. Concrectly truffle-config.js production part.
            – Eduardo
            Nov 27 '18 at 11:51










          • @Eduardo: They go into ARG1, ARG2 and ARG3. This is useful if you need to pass inputs arguments to constructors.
            – goodvibration
            Nov 27 '18 at 13:12












          • Yes, but I mean what is the purpose with this js file?? 0x123 0x456 0x789 what represent?
            – Eduardo
            Nov 27 '18 at 13:49










          • @Eduardo: It's an example of how you pass arguments when you call truffle deploy!!!
            – goodvibration
            Nov 27 '18 at 14:24


















          • Sorry but I can´t undestand the purpose of your code. 0x123 0x456 0x789 values what mean? The rest I undestand and it result me very usefull. Concrectly truffle-config.js production part.
            – Eduardo
            Nov 27 '18 at 11:51










          • @Eduardo: They go into ARG1, ARG2 and ARG3. This is useful if you need to pass inputs arguments to constructors.
            – goodvibration
            Nov 27 '18 at 13:12












          • Yes, but I mean what is the purpose with this js file?? 0x123 0x456 0x789 what represent?
            – Eduardo
            Nov 27 '18 at 13:49










          • @Eduardo: It's an example of how you pass arguments when you call truffle deploy!!!
            – goodvibration
            Nov 27 '18 at 14:24
















          Sorry but I can´t undestand the purpose of your code. 0x123 0x456 0x789 values what mean? The rest I undestand and it result me very usefull. Concrectly truffle-config.js production part.
          – Eduardo
          Nov 27 '18 at 11:51




          Sorry but I can´t undestand the purpose of your code. 0x123 0x456 0x789 values what mean? The rest I undestand and it result me very usefull. Concrectly truffle-config.js production part.
          – Eduardo
          Nov 27 '18 at 11:51












          @Eduardo: They go into ARG1, ARG2 and ARG3. This is useful if you need to pass inputs arguments to constructors.
          – goodvibration
          Nov 27 '18 at 13:12






          @Eduardo: They go into ARG1, ARG2 and ARG3. This is useful if you need to pass inputs arguments to constructors.
          – goodvibration
          Nov 27 '18 at 13:12














          Yes, but I mean what is the purpose with this js file?? 0x123 0x456 0x789 what represent?
          – Eduardo
          Nov 27 '18 at 13:49




          Yes, but I mean what is the purpose with this js file?? 0x123 0x456 0x789 what represent?
          – Eduardo
          Nov 27 '18 at 13:49












          @Eduardo: It's an example of how you pass arguments when you call truffle deploy!!!
          – goodvibration
          Nov 27 '18 at 14:24




          @Eduardo: It's an example of how you pass arguments when you call truffle deploy!!!
          – goodvibration
          Nov 27 '18 at 14:24











          2














          I think at this stage of Ethereum (4 years old) and Truffle (3 years old), we can definitely recommend the Truffle suite to deploy contracts safely anywhere. It's a trusted software recognized by the entire Ethereum community.



          However, it doesn't make your private key safe or anything like that. You are responsible for the security of your private keys used to deploy those contracts.






          share|improve this answer





















          • Understand thx for the info ;D
            – Eduardo
            Nov 27 '18 at 11:47
















          2














          I think at this stage of Ethereum (4 years old) and Truffle (3 years old), we can definitely recommend the Truffle suite to deploy contracts safely anywhere. It's a trusted software recognized by the entire Ethereum community.



          However, it doesn't make your private key safe or anything like that. You are responsible for the security of your private keys used to deploy those contracts.






          share|improve this answer





















          • Understand thx for the info ;D
            – Eduardo
            Nov 27 '18 at 11:47














          2












          2








          2






          I think at this stage of Ethereum (4 years old) and Truffle (3 years old), we can definitely recommend the Truffle suite to deploy contracts safely anywhere. It's a trusted software recognized by the entire Ethereum community.



          However, it doesn't make your private key safe or anything like that. You are responsible for the security of your private keys used to deploy those contracts.






          share|improve this answer












          I think at this stage of Ethereum (4 years old) and Truffle (3 years old), we can definitely recommend the Truffle suite to deploy contracts safely anywhere. It's a trusted software recognized by the entire Ethereum community.



          However, it doesn't make your private key safe or anything like that. You are responsible for the security of your private keys used to deploy those contracts.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 27 '18 at 9:46









          Greg JeanmartGreg Jeanmart

          4,5172922




          4,5172922












          • Understand thx for the info ;D
            – Eduardo
            Nov 27 '18 at 11:47


















          • Understand thx for the info ;D
            – Eduardo
            Nov 27 '18 at 11:47
















          Understand thx for the info ;D
          – Eduardo
          Nov 27 '18 at 11:47




          Understand thx for the info ;D
          – Eduardo
          Nov 27 '18 at 11:47



          Popular posts from this blog

          Plaza Victoria

          In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

          How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...