Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The Go Smart Contracts Development Kit (GSCDK) provides a comprehensive toolkit for creating, building, and debugging Go-based smart contracts.
Here is an example of what a Go Smart Contract looks like using GSCDK:
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)
}
}
Jump right into building your first smart contract with our Quick Start Guide.
To install GSCDK, run the following command:
For Unix-based platforms (like Linux or macOS):
python3 -m pip install gscdk
For Windows:
python -m pip install gscdk
If you've previously installed GSCDK and want to upgrade to the latest version, use the following command:
For Unix-based platforms:
python3 -m pip install --upgrade gscdk
For Windows:
python -m pip install --upgrade gscdk
To build the tinygo
command that supports building Go Smart Contracts, follow the instructions in Building. Once built, add the tinygo
command to your PATH:
export PATH=$(pwd)/compiler/build:$PATH
go-contract
is a powerful tool for managing your smart contract projects. Learn more about its features below:
Use the "init" command to initialize a project with a specific contract name:
go-contract init mycontract
cd mycontract
Use the "gencode" command to generate ABI and extra code for smart contracts:
go-contract gencode
Note: Code generation is also the default option for the "build" command.
To compile the source code of your project, use the "build" command:
go-contract build
To disable code generation during the build process, use the -gen-code=false
flag:
go-contract build -gen-code=false
To disable code optimization, use the -d
or --debug
option:
go-contract build -d
Before debugging, install ipyeos
:
python3 -m pip install ipyeos
To update to a new version, use the following command:
python3 -m pip install -U ipyeos
Then run the debugging server:
eosdebugger
On Windows, use a Docker image to run a debugging server.
First, pull ipyeos docker image:
docker pull ghcr.io/uuosio/ipyeos:latest
then start a debugging server from docker:
docker run -it --rm -p 9090:9090 -p 9092:9092 -t ghcr.io/uuosio/ipyeos
Here's a sneak peek of the debugger in action:
To generate a code coverage report in HTML, follow these steps:
go-contract build
TEST_COVERAGE=1 go test -coverprofile=coverage.out
go tool cover -html=coverage.out
Here's an example of what the code coverage report looks like:
FAQs
Go Smart Contract Development Kit
We found that gscdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.