当前位置:网站首页>长安链GO语言智能合约编写与编译
长安链GO语言智能合约编写与编译
2022-06-29 08:42:00 【帅气的梧桐述】
拉取镜像
docker pull chainmakerofficial/chainmaker-docker-go-contract:v2.2.1创建工作目录$WORK_DIR
例如/data/workspace/contract,挂载到docker容器中以方便后续进行必要的一些文件拷贝。
mkdir -p /data/workspace/contract启动容器
$ docker run -it --name chainmaker-docker-go-contract -v /data/workspace/contract:/home chainmakerofficial/chainmaker-docker-go-contract:v2.2.1 bash启动容器后,会自动进入容器的根目录。
拷贝模板
进入容器的/data目录下有一个go语言的智能合约模板,将至拷贝到/home目录(意味着同时拷贝到了宿主机的挂载/data/workspace/contract目录下)
# cd /data/
# ls
admin1.sign.crt contract_docker_go_template.tar.gz
# cp contract_docker_go_template.tar.gz /home再将服务器/data/workspace/contract目录下的contract_docker_go_template.tar.gz拷贝到开发智能合约的电脑下,解压即可获取contract_docker_go的一个智能合约开发demo项目。或者下载官方的contract-sdk-docker-go项目。
Sign in · ChainMaker欢迎使用长安链开源平台https://git.chainmaker.org.cn/chainmaker/contract-sdk-docker-go
编写合约
contract_docker_go的合约项目中,主要需要修改的就是main.go。根据自己的智能合约开发需求,重新编写或修改main.go。
编译和压缩合约
首先将编写好的contract_docker_go项目源文件重新拷贝回服务器/data/workspace/contract,然后再次进入chainmaker-docker-go-contract容器中,对应的容器目录为/home/contract_docker_go
$ cd /home
$ cd contract_docker_go
$ ./build.sh
please input contract name, contract name should be same as name in tx:
<contract_name> #此处contract_name必须和交易中的合约名一致
please input zip file:
<zip_file_name> #建议与contract_name保持一致(不用加文件后缀)
...编译,压缩好的文件位置在.
/home/contract_docker_go/<contract_name>.7z成功后,可将<contract_name>.7z压缩包拷贝到长安链节点环境使用cmc命令部署,或者使用sdk创建智能合约。具体方式可参考另一篇博客长安链GO语言智能合约环境搭建及使用
http://t.csdn.cn/8DNaN
边栏推荐
- How is epoll encapsulated in golang?
- PAT (Basic Level) Practice (中文)1003 我要通过! (20分) C语言实现
- UE4 在viewport视口中显示3D可编辑点
- What exactly does Devops mean?
- MH/T 6040航空材料烟密度试验
- Jar package and war package
- Pytorch Summary - sensor on GPU
- Wechat applet jump to official account image and text content
- Summary of 3DMAX jamming, white screen and rendering crash
- 微信小程序子组件向页面传值(父子组件间的通信)带源码
猜你喜欢

Summary of IO streams

Pytorch Summary - Automatic gradient

Wechat applet sharing page, sharing to the circle of friends

H5 soft keyboard problem
![[target detection] | indicator a probabilistic challenge for object detection](/img/82/7b830d44bed7b1509cb0cdfed88e3e.png)
[target detection] | indicator a probabilistic challenge for object detection

What exactly does Devops mean?

Open3d farthest point sampling (FPS)

Redo after JS rotation view (longer full version, can be run)

The former security director of Uber faced fraud allegations and concealed the data leakage event

Uni app gets the route URL of the current page
随机推荐
How to implement observer mode
LSM6DSL之SPI驱动
SSD改進CFENet
Wechat applet project: wechat applet page layout
NPM common commands
cmd进入虚拟机
Wechat applet project: tab navigation bar
Professional structure record
UE4 VS的Visual Assist插件设置
Wechat applet determines the file format of URL
Debug H5 page -vconsole
UE4 编译单个文件(VS与编辑器分别启动)
Training kernel switching using GPU
Detecting and counting tiny faces
UE4 材质UV纹理不随模型缩放拉伸
UE4 插件报错 Cannot open include file: ‘ModuleManager.h‘解决
HB5470民用飞机机舱内部非金属材料燃烧测试
网络安全问题
微信小程序打开文件流
Handwritten virtualdom