티스토리 뷰
truffle로 Solidity개발 시작하기
코인쪽 일을 하다보니 솔리디티 정도는 알아두는게 좋을 것 같아서 세미나도 듣고 해커톤도 해서 시작을 할 수 있게 되어서 이 포스트를 쓴다.
repo
https://github.com/Kyeongrok/truffle_hello
필요한 것
node.js, npm
npm install -g truffle
ganache(mac), ganache-cli
디렉토리 만들기 truffle init 하기
mkdir truffle_01
cd truffle_01
truffle init
프로젝트 구조
migrations/2_second.js
1 2 3 4 5 6 | const HelloToken = artifacts.require("./HelloToken.sol"); module.exports = function(deployer) { deployer.deploy(HelloToken) } | cs |
contracts/HelloToken.sol
1 2 3 4 5 6 7 8 9 10 11 12 | pragma solidity ^0.4.24; contract HelloToken { function hello() public pure{ } function hello2() public view returns(string){ return "hello"; } } | cs |
truffle.js
1 2 3 4 5 6 7 8 9 10 11 12 | module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // to customize your Truffle configuration! networks: { development: { host: "localhost", port: 7545, network_id: "*" // Match any network id } } }; | cs |
test/hello_token.js
1 2 3 4 5 6 7 8 9 10 11 | const HelloToken = artifacts.require("./HelloToken.sol"); contract('HelloToken', (accounts) => { it("hello2", () => { return HelloToken.deployed().then(instance => { instance.hello2().then(result => console.log(result)) }); }); }); | cs |
ganache로 개발용 네트웍 띄우기
https://truffleframework.com/ganache
위 링크에서 gui버젼 받거나
npm i -g ganache-cli 로 cli버젼 설치
ganache-cli -u 0으로 실행
배포하기
truffle migrate
또는
truffle migrate --network development
또는
truffle migrate --network development --compile-all --reset
배포 되었는지 확인하기
로그에 뭔가 올라오면 잘 배포 된것
728x90
'미분류 비공개' 카테고리의 다른 글
이더스캔(ethscan)사용법 (0) | 2018.07.26 |
---|---|
ICO 프로젝트 아이디어 - 경록김의 뷰티풀프로그래밍(KRK) (0) | 2018.07.13 |
truffle box react 시작하기 (0) | 2018.07.07 |
metamask로 ganache연결하기 (0) | 2018.07.06 |
eth explorer 설치하기 (0) | 2018.07.05 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- docker container
- 도커각티슈박스
- docker container tissue box
- 도커티슈박스
- shellscript
- 2017 티스토리 결산
- vim
- docker container tissue
- 도커각티슈케이스
- Sh
- docker container case
- Linux
- 싱가폴
- docker container whale
- 개발자
- 도커컨테이너
- 도커티슈케이스
- 이직
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함