What does Truffle + WalletConnect mean?

Sergii Bomko
Jan 20 · 2 min read

Most of Ethereum Smart Contracts developers know Truffle. It is the ultimate toolset for the development of Smart Contracts.

When the Smart Contract development phases passed you need to deploy the smart contract to test or live network. The phase usually requires using a private key for signing transactions before sending those to the network. The regular approaches in the case are using seed phrase or private key during the deployment phase. The configuration for deployment may look like:

const PrivateKeyProvider = require("truffle-privatekey-provider");
const HDWalletProvider = require("truffle-hdwallet-provider");
const provider = new PrivateKeyProvider(
process.env.PKEY, "https://rpc.url")
// --OR--const provider = new HDWalletProvider(
process.env.MNEMONIC, "https://rpc.url")
module.exports = {
networks: {
rinkeby: {
provider,
network_id: 4
}
}
}

process.env.PKEY and process.env.MNEMONIC are stored in an environment where deployment happens. You always need to think about how to share these variables between environments securely. WalletConnect allows you to avoid the issue in a way that the private key for deployment can be stored on your mobile phone.

You can imagine your deployment process:

  1. Start migration truffle migrate — network rinkeby

2. Connect and sign with WalletConnect

3. Results

There is no need to store a private key or seed phrase with WalletConnect provider. Configuration for Truffle:

const WalletConnectProvider = require("wallet-connect-provider");

const provider = new WalletConnectProvider({
rpcUrl: "https://rpc.url"
});

module.exports = {
networks: {
rinkeby: {
provider,
network_id: 4
}
}
}

GitHub, npm of the project

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade