Avatar
0
monkey Enlightened
monkey Enlightened
Blockchain: làm sao chuyển eth ra khỏi contract?
Làm sao chuyển eth ra khỏi contract?
Answer
Avatar
0
monkey Enlightened
monkey Enlightened
Blockchain: Chuyển eth từ wallet address vào contract address
Làm thế nào để chuyển eth từ 1 wallet address vào 1 contract address?
Answer
Avatar
0
monkey Enlightened
monkey Enlightened
Blockchain: Deploy vả sử dụng smart contract từ web3 java client
Blockchain: Deploy vả sử dụng smart contract từ web3 java client
Answer
Avatar
0
monkey Enlightened
monkey Enlightened
Deploy ERC721 (NFT) lên mạng private
Dể deploy ERC721 (NFT) lên mạng private, chúng ta cần trải qua các bước sau: <p> </p> <ol start="1"> <li>Tải ERC721 contract <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts">tại đây</a> </li> <li>1 Copy toàn bộ thư mục contracts của <code>openzeppelin-contracts</code> vào thư mục contracts của truffles </li> <li>2 Sau khi copy chúng ta sẽ cấu trúc thư mục kiểu này: </li> </ol> <p> </p> <img src="https://stackask.com/wp-content/uploads/2021/11/Screen-Shot-2021-11-05-at-5.24.33-PM.png" alt="" class="alignnone size-full wp-image-2977" /> <p> </p> <ol start="2"> <li>Sửa file truffle-config.js thế này: </li> </ol> <p> </p> <pre> module.exports = { networks: { development: { host: "localhost", port: 8545, network_id: "*", gas: 0, from: "0x3c31b4b9d6c24bad29498f99aaa6914231362c7f" } }, compilers: { solc: { version: "0.8.0" } } }; </pre> <p> </p> <ol start="3"> <li>Sửa file 1_initial_migration.js thế này: </li> </ol> <p> </p> <pre> const ERC721 = artifacts.require("token/ERC721"); module.exports = function (deployer) { const collectionName = 'My First Collection'; const collectionSymbol = 'MFCL'; deployer.deploy( ERC721, collectionName, collectionSymbol ); }; </pre> <p> </p> <ol start="4"> <li>Chạy truffle compile </li> <li>Chạy trufle migrate </li> </ol> <p> </p> <ol start="6"> <li>Sau khi đã deploy contract thành công chúng ta sẽ chạy <code>truffle console</code> và gọi thử các lệnh: </li> </ol> <p> </p> <pre> let contract = await ERC721.deployed() contract.name() contract.symbol() contract.transfer("0xf6de26f382078d34446b133fd54191fe49c77273", 1000) contract.balanceOf("0xf6de26f382078d34446b133fd54191fe49c77273") </pre> <p> </p> <p> Kết quả chúng ta sẽ nhận được: </p> <p> </p> <pre> truffle(development)&gt; let contract = await ERC721.deployed() undefined truffle(development)&gt; contract.name() 'My First Collection' truffle(development)&gt; contract.symbol() 'MFCL' </pre>
Answer