Go Smart Contract Development Kit
Project description
Go Smart Contracts Development Kit
What the Go Smart Contracts look like?
Here is an example
package main
import (
"github.com/uuosio/chain"
)
//table mytable
type MyData struct {
primary uint64 //primary: t.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
scope := code
payer := c.Receiver
mydb := NewMyDataDB(code, scope)
primary := uint64(111)
if it, data := mydb.Get(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)
}
}
Installation
python3 -m pip install gscdk
For Windows platform:
python -m pip install gscdk
Upgrade From an Old Version
python3 -m pip install --upgrade gscdk
For Windows platform:
python -m pip install --upgrade gscdk
Installing gscdk in Docker
Building docker image for gscdk
docker build github.com/learnforpractice/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 tinygo command in compiler/build directory that support for building Go Smart Contracts.
export PATH=$(pwd)/compiler/build:$PATH
eosio-go
Initializing a project with "init" subcommand
"init" command initialize a project with contract name
eosio-go init mycontract
cd mycontract
Generating ABI and Extra Code for Smart Contracts
eosio-go gencode
Code generation is also the default option for "build" command
Building Go Smart Contracts Project
Compiling the Source Code
eosio-go build -o mycontract.wasm .
Disable Code Generation during Building
eosio-go build -gen-code=false -o mycontract .
Disable Striping WASM File after Building
eosio-go build -strip=false -o mycontract .
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gscdk-0.4.0.tar.gz.
File metadata
- Download URL: gscdk-0.4.0.tar.gz
- Upload date:
- Size: 64.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed5662f307c6398ac4d5f4540f85b33662ded4e0aa5183c37b2559021b10b06b
|
|
| MD5 |
c1e4584bd857fc5abdf33fef08ef754c
|
|
| BLAKE2b-256 |
8d173ee7fe0fdee101564ba33a9779e9ab0646a43bd45f3f69463876d11e4d47
|
File details
Details for the file gscdk-0.4.0-py3-none-win_amd64.whl.
File metadata
- Download URL: gscdk-0.4.0-py3-none-win_amd64.whl
- Upload date:
- Size: 64.4 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0ad2ed1c22e584b5bbe336eb4da8f5bb44500b07a857d682abfde681ac6b6ec
|
|
| MD5 |
23cd70662fa0dc08e95c447ea3833163
|
|
| BLAKE2b-256 |
601e167726afe82eac3aa22f00f550d36b1d9f2896e35cae97ea2102962b75c0
|
File details
Details for the file gscdk-0.4.0-py3-none-manylinux1_x86_64.whl.
File metadata
- Download URL: gscdk-0.4.0-py3-none-manylinux1_x86_64.whl
- Upload date:
- Size: 69.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd2e19ef7f656bd3eed362080b85ec1b48242afcaa26c75189a91cd526ac9d96
|
|
| MD5 |
dd9f1bf5d8568e6dd7dd93b8d03ed0ae
|
|
| BLAKE2b-256 |
63f99f542479502b4eedc308156d48f1d19eee5cab12b5e60c42cb124df588a7
|
File details
Details for the file gscdk-0.4.0-py3-none-macosx_10_15_x86_64.whl.
File metadata
- Download URL: gscdk-0.4.0-py3-none-macosx_10_15_x86_64.whl
- Upload date:
- Size: 55.4 MB
- Tags: Python 3, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72189199f4ddd1274b752b97cb97739effba0c3d96fb571dd1a890dd30bc4d3b
|
|
| MD5 |
7a8cc09a69fa5e78d71cb1871f107d8e
|
|
| BLAKE2b-256 |
10512f772cae4b04e7ce2c5c643c554bbe1e186493f91b4f8dd4516d7d8b8f28
|