Deployment with Infura
In this step we are deploying our token into the Test-Network, either Gƶrli or Ropsten. We do this without setting up our own Blockchain Node. We use a hosted node with Infura.
Because our setup is already so well prepared, itās extremely easy to do so.
Signup with Infura
First thing is to signup with Infura. Go to https://infura.ioā and signup with your email address.
Confirm the Mail address and enter the dashboard.
Create a new Infura Project
First you need to create a new Infura Project
Give it a name:
And hit āCREATEā.
View the Project:
This is the important ID you will need:
Update the truffle-config.json File
Now letās update the truffle-config.json file so we can deploy using the nodes from Infura. Add a new network:
networks: {
development: {
port: 7545,
network_id: "*",
host: "127.0.0.1"
},
ganache_local: {
provider: function() {
return new HDWalletProvider(process.env.MNEMONIC, "http://127.0.0.1:7545", MetaMaskAccountIndex)
},
network_id: 5777
},
ropsten_infura: {
provider: function() {
return new HDWalletProvider(process.env.MNEMONIC, "https://ropsten.infura.io/v3/YOUR_INFURA_ID", MetaMaskAccountIndex)
},
network_id: 3
},
goerli_infura: {
provider: function() {
return new HDWalletProvider(process.env.MNEMONIC, "https://goerli.infura.io/v3/YOUR_INFURA_ID", MetaMaskAccountIndex)
},
network_id: 5
}
},
compilers: {
solc: {
Where it says āYOUR_INFURA_IDā enter the ID from your own Infura Dashboard please! Thatās it. Letās run this!
Run the Migrations
The last part is to run the migrations. At the very beginning of the course we got some test-ether in our MetaMask. You should still have them. Just run the Migrations and see if it works:
truffle migrate --network ropsten_infura
and watch the output ā this might take a while:
And then open your Browser Window again and switch MetaMask to the Ropsten (or Gƶrli) network, depending on which one you deployed. You already can see that you have no tokens there, but also the address of the TokenSale contract changed:
You could go ahead and whitelist another account now and get some tokens. You can also implement a spending token facility, for actually burning tokens once the cappuccino is bought. Before we do that, letās change the whole crowdsale!