All Products
Search
Document Center

Configure truffle

Last Updated: Jan 17, 2019

Truffle is a development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier. Use the following steps to connect your existing truffle project to the Quorum node of the Alibaba Cloud BaaS.

  1. Get the Quorum node’s username username and password password. If you have not configured a username and password, you can configure it following the steps in Node Security Management.

  2. Get the Quorum node’s RPC service address noderpcaddress, you can find this information in the Access Endpoint column of My Nodes table.

  3. Get the network ID networkid of the Quorum network which the node has joined. You can find this information in the Network ID column of My Ethereum table.

  4. Modify the truffle project’s configuration file truffle.js based on the information obtained.

  1. var Web3 = require("web3");
  2. module.exports = {
  3. // See <http://truffleframework.com/docs/advanced/configuration>
  4. // for more about customizing your Truffle configuration!
  5. networks: {
  6. development: {
  7. provider: function() {
  8. var provider = new Web3.providers.HttpProvider(
  9. "http://${username}:${userpassword}@${noderpcaddress}",
  10. {
  11. keepAlive: false,
  12. timeout: 5000
  13. }
  14. );
  15. return provider;
  16. },
  17. network_id: "${networkid}",
  18. from: "${youraccount}",
  19. gas: 461238800,
  20. gasPrice: 0
  21. }
  22. }
  23. };