使用Docker Python 構建智能合約
使用solidity的truffle框架開發智能合約,使用Docker Python調用合約。
1. 合約編寫、編譯和部署
- 將 https://github.com/jamess010/AIOpen/tree/master/data/blockchain/docker-web3-python 內容拷貝下來
- cd ./docker-web3-python
- mkdir - p smartcontract
- cd ./smartcontract
- truffle init (port: 9545)
- truffle compile
- truffle migrate (--reset)
2. 使用 jupyter notebook 進行 python 調用
- 打開瀏覽器,輸入 http://localhost:8828
- 打開 test_modelrepo.ipynb
- 按照 notebook 步驟進行