docker network create hokusai-network
docker-compose up
docker-compose down
use the Ethers.js and Waffle plugins.
The hardhat-typechain is also automatically executed at this time.
yarn hardhat compile
yarn hardhat test
about web3/contracts/Profile.compiled.json
- Generation
yarn hardhat compile
- A cache directory and an artifacts directory are generated.
(cacheディレクトリとartifactsディレクトリが生成されます) - Move & rename Profile.json generated in contracts directory .
(contractsディレクトリ内に生成されるProfile.jsonを移動 & rename)
- Activate hardhat node in web3 container
docker exec web3 npx hardhat node
- Deploy contract and get contract address
curl --location --request POST 'http://localhost:8080/v1/0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266/profile' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Bob",
"email": "bob@example.com"
}'
- Get contract information including {Contract address obtained in 2}
curl --location --request GET 'http://localhost:8080/v1/0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266/profile/{Contract address obtained in 2}' \
--header 'Content-Type: application/json'
-
Contract Factory Class generated by hardhat-typechain.
-
The hardhat-typechain will generate it with abi and bytecode inside. Therefore, there is no need to set the compiled abi and bytecode by yourself. (内部にabiとbytecodeを持った状態でhardhat-typechain が生成してくれる。 なので、compileしたabiとbytecodeを自分で設定する必要がない。)
-
If not used, it is necessary to import abi and bytecode from the json generated by compiling contract. (もし使用しない場合、contractをcompileして生成されたjsonから、abiとbytecodeをimportする必要がある。)