4

如何在conflux上部署合约

 2 years ago
source link: https://igaojin.me/2019/12/03/%E5%A6%82%E4%BD%95%E5%9C%A8conflux%E4%B8%8A%E9%83%A8%E7%BD%B2%E5%90%88%E7%BA%A6/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

如何在conflux上部署合约

https://remix.ethereum.org/ 上面编写好合约

编译好了就可以拿到ABI 以及 Bytecode了.(后面用)

创建conflux 地址

有好几种方式,因为conflux地址是与eth兼容的,所以你可以直接使用你的eth地址

当然也可以使用官方的js,或者在线钱包

打开https://wallet.confluxscan.io/wallet就可以创建了

本地js创建(推荐,因为后面部署合约也需要用到

先下载github repo并初始化

git clone https://github.com/jin10086/confluxBuildContract.git
cd confluxBuildContract
npm install //初始化环境

直接执行 node createAccount.js 就创建好了

(base) ➜  confluxBuildContract git:(master) ✗ node createAccount.js
pub_key: 0xa17b63007bd491822306b3b8c793311e7a21e8de
priv_key: 0x0ac9e33baa5cc302785a7fa1ef8912ff34b492ad0d52c7d518fe80975191bbaa

领取测试代币

因为新地址是没有代币的,所以需要先领取

直接浏览器打开 https://wallet.confluxscan.io/faucet/dev/ask?address=你的pub_key

就可以领取了

  1. deployContract.js里面的pub_key priv_key改成刚才生成的公钥以及私钥
  2. deployContract.js里面的abi bytecode改成在remix生成的
  3. 执行 node deployContract.js 就可以部署合约了

部署返回结果如下

(base) ➜  confluxBuildContract git:(master) ✗ node deployContract.js       
contract deployed. address: 0x26f9269a3d09c5d7ca7066445fc30ca91b9aa3bc

可以在http://www.confluxscan.io/ 上查看刚刚部署成功的合约

本文作者:高金
本文地址https://igaojin.me/2019/12/03/如何在conflux上部署合约/
版权声明:转载请注明出处!

0 comments

Be the first person to leave a comment!

分享

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK