Skip to content

Instantly share code, notes, and snippets.

@qcgg
qcgg / quarkchain-web3-contract-example.js
Last active November 1, 2019 08:59
Sample code to deploy smart contract on QuarkChain testnet using quarkchain-web3.js
// Sample code to deploy smart contract on QuarkChain testnet using quarkchain-web3.js
// https://github.com/QuarkChain/quarkchain-web3.js
// Contract code is taken from https://testnet.quarkchain.io/contract
// The code can run in the browser console while on http://testnet.quarkchain.io/contract (not https)
// MetaMask is required to sign the transaction and you need testnet tokens in your account
var abi = [{"constant":true,"inputs":[],"name":"getBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newgreeting","type":"string"}],"name":"setGreeting","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}];
var byteCode = "0x6080