Go Smart Contract Development Kit
Project description
Go Smart Contracts Development Kit
Debugger
Code Coverage
What a Go Smart Contract looks like?
Here is an example
package main
import (
"github.com/uuosio/chain"
)
//table mytable
type MyData struct {
primary uint64 //primary
name string
}
//contract mycontract
type MyContract struct {
Receiver chain.Name
FirstReceiver chain.Name
Action chain.Name
}
func NewContract(receiver, firstReceiver, action chain.Name) *MyContract {
return &MyContract{receiver, firstReceiver, action}
}
//action sayhello
func (c *MyContract) SayHello(name string) {
code := c.Receiver
payer := c.Receiver
mydb := NewMyDataDB(code)
primary := uint64(111)
if it, data := mydb.GetByKey(primary); it.IsOk() {
if data.name != name {
chain.Println("Welcome new friend:", name)
} else {
chain.Println("Welcome old friend", name)
}
data.name = name
mydb.Update(it, data, payer)
} else {
chain.Println("Welcome new friend", name)
data := &MyData{primary, name}
mydb.Store(data, payer)
}
}
Quick Start
Installation
python3 -m pip install gscdk
For the Windows platform:
python -m pip install gscdk
Upgrade From an Old Version
python3 -m pip install --upgrade gscdk
For the Windows platform:
python -m pip install --upgrade gscdk
Installing gscdk in Docker
Building docker image for gscdk
docker build https://github.com/uuosio/gscdk-docker#main -t gscdk/test
Running
docker run -w /root/dev -it --rm -v "$(pwd)":/root/dev -t gscdk/test /bin/bash
Building Go Smart Contracts Compiler
Follow the steps in Building
That will build the tinygo
command in the compiler/build directory that supports building Go Smart Contracts.
export PATH=$(pwd)/compiler/build:$PATH
go-contract
Initializing a project with the "init" subcommand
The "init" command initializes a project with the contract name
go-contract init mycontract
cd mycontract
Generating ABI and Extra Code for Smart Contracts
go-contract gencode
Code generation is also the default option for the "build" command
Building Go Smart Contracts Project
Compiling the Source Code
go-contract build
Disable Code Generation during Building
go-contract build -gen-code=false .
Disable Code Optimization
Specifying -d
or --debug
option to disable wasm optimization.
go-contract build -d
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gscdk-0.7.1.tar.gz
(68.7 MB
view hashes)
Built Distributions
Close
Hashes for gscdk-0.7.1-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b43d4d1c7955c3380b08d813e77ac6dcf4190465244d7830f036ccff63c3f64a |
|
MD5 | aa1ee5950843eee39560694eb0ae7e0d |
|
BLAKE2b-256 | d141cae576881a3c2dfc62b922698d2ab2457daa0135524a106a1b8e6585a6f8 |
Close
Hashes for gscdk-0.7.1-py3-none-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a30125a9ee5645bfe539fdda1c7389961fc1c813ab714076f224f2abc31804d9 |
|
MD5 | 1f2778be982b0a442b30afd0b8a9c657 |
|
BLAKE2b-256 | 26ce26441269bb5c681f33f4b33f768d203334efe027bf6705ab71202592a72a |
Close
Hashes for gscdk-0.7.1-py3-none-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49f2de454745c6a1584a0c156259eefc3a10463102a66cae9675a70453b317f7 |
|
MD5 | bea751753c5d78678d87570f29f762d2 |
|
BLAKE2b-256 | eb36e2657cc55eb3c1c09dd618e81bf32d614df01e43a5f65577c909b764f9ba |