Skip to content

Latest commit

 

History

History
112 lines (90 loc) · 5.2 KB

1-09.md

File metadata and controls

112 lines (90 loc) · 5.2 KB
Step 9: Deploy

Now that we have some tests in place that prove out metadata works and our token can be minted let's deploy it to our local network, then deploy it to Rinkeby. First is the local version like we did before. In one console window set Truffle's local RPC running (you'll notice the mnemonic phrase is always the same).

$ yarn develop
Truffle Develop started at http://127.0.0.1:9545/

Accounts:
(0) 0x627306090abab3a6e1400e9345bc60c78a8bef57
(1) 0xf17f52151ebef6c7334fad080c5704d77216b732
(2) 0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef
(3) 0x821aea9a577a9b44299b9c15c88cf3087f3b5544
(4) 0x0d1d4e623d10f9fba5db95830f7d3839406c6af2
(5) 0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e
(6) 0x2191ef87e392377ec08e7c08eb105ef5448eced5
(7) 0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5
(8) 0x6330a553fc93768f612722bb8c2ec78ac90b3bbc
(9) 0x5aeda56215b167893e80b4fe645ba6d5bab767de

Private Keys:
(0) c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3
(1) ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f
(2) 0dbbe8e4ae425a6d2687f1a7e3ba17bc98c673636790f1b8ad91193c05875ef1
(3) c88b703fb08cbea894b6aeff5a544fb92e78a18e19814cd85da83b71f772aa6c
(4) 388c684f0ba1ef5017716adb5d21a053ea8e90277d0868337519f97bede61418
(5) 659cbb0e2411a44db63778987b1e22153c086a95eb6b18bdf89de078917abc63
(6) 82d052c865f5763aad42add438569276c00d3d88a2d062d36b2bae914d58b8c8
(7) aa3680d5d48a8283413f7a108367c7299ca73f553735860a87b08f39395618b7
(8) 0f62d96d6675f32685bbdb8ac13cda7c23436f63efbb9d07700d8669ff12b7c4
(9) 8d5366123cb560bb606379f90a0bfd4769eecc0557f1b362dcae9012b548b1e5

Mnemonic: buddy drum hawk truck taxi dish card medal sketch shallow intact stool

⚠️  Important ⚠️  : This mnemonic was created for you by Truffle. It is not secure.
Ensure you do not use it on production blockchains, or else you risk losing funds.

truffle(develop)>

Now run the deploy command in the original terminal window. We'll set it to just be the first two migrations so that we don't update the metadata contract on this deploy. If you get something weird it might be because of the build folder, it's meant to help but it's often just a pain. You can rm -r build to get rid of it. This is fine to do until you've deployed to a network where you care that it remains. Because the contract address is actually stored in this build folder, if you want your migration process to remember that it'll need access to those files. So like when we updated the metadata by specifying the third migration file, it knew where the token was deployed because it had the file in the build folder. So now it's fine but just remember that information may be important to you before deleting it.

$ yarn migrate --network develop -f 1 --to 2

...


Writing artifacts to ./build/contracts

Using network 'develop'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0x6baaa7955d7815f8629b969c7a33da9ee5d13657e623c19fd0f9f592a8d68e87
  Migrations: 0x8cdaf0cd259887258bc13a92c0a6da92698644c0
Saving successful migration to network...
  ... 0xd7bc86d31bee32fa3988f1c1eabce403a1b5d570340a3a9cdba53a472ee8c956
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Running step...
  Replacing Metadata...
  ... 0xe3772c4b0d577fe44ee19414a124ef24f1d2a16ad3c98931253279dad8e4fd56
  Metadata: 0x345ca3e014aaf5dca488057592ee47305d9b3e10
        Metadata deployed at: 0x345ca3e014aaf5dca488057592ee47305d9b3e10
  Replacing Token...
  ... 0x4c3b1d9db3970110fa8d0396ae7f3d446a9aad619449f736e92fa60cd2cf0676
  Token: 0xf25186b5081ff5ce73482ad761db0eb0d25abfbf
        Token deployed at: 0xf25186b5081ff5ce73482ad761db0eb0d25abfbf
Saving successful migration to network...
  ... 0x059cf1bbc372b9348ce487de910358801bbbd1c89182853439bec0afaee6c7db
Saving artifacts...

You can see that this command says "Replacing" because it can see from the previous artifacts that we have in fact deployed these contracts before. Now let's try deploying to Rinkeby, make sure that the mnemonic phrase you have has some ether in it.

$ yarn migrate --network rinkeby -f 1 --to 2
Using network 'rinkeby'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0xcc78688c19e982cb493b99db2252daa074287e9fbe22906f105801700550bab7
  Migrations: 0xd1aaf438955055c35aeb46b4bd695997bcd21abd
Saving successful migration to network...
  ... 0xaa69e3196f1928c6dfc0f91dd58e65e1217a6d4a560a7636d17b6e56bf52aeb3
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Running step...
  Deploying Metadata...
  ... 0x19e5eaa13843cea2178792c57fd1f35c99d563a1aec4b7f2b1613209c1e5a930
  Metadata: 0x61bda2050eafa50fb46ebeb39c75fbe4781bdf55
        Metadata deployed at: 0x61bda2050eafa50fb46ebeb39c75fbe4781bdf55
  Deploying Token...
  ... 0x9f74c46ffd6c339246baee70b4b90f649d43de5d274ccdcc82ee10bc680c010d
  Token: 0x1170a2c7d4913d399f74ee5270ac65730ff961bf
        Token deployed at: 0x1170a2c7d4913d399f74ee5270ac65730ff961bf
Saving successful migration to network...
  ... 0xb650e010b55dab9cf82a3fc2074ce75b1987015cad8e44d93bb0546df5f411d8
Saving artifacts...

If you're feeling really brave and have a mnemonic phrase with some mainnet ether feel free to go big : )

Commit your changes

git add . && git commit -m 'Step 9: Deploy'

Go to step 10