fabric-erc20-go

command module
v0.0.0-...-d8468af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 12 Imported by: 0

README

Sample ERC20 token implementation with Hyperledger Fabric chaincode (Golang)

This is the Golang chaincode version of Ethereum's ERC20 token standard based OpenZeppelin's implementation

Basic features:

  • Basic Token
  • Ownable Token
  • Detailed Token
  • Mintable Token
  • Burnable Token
  • Pausable Token

Custom feature:

  • Transaction memo - able to attach an 'memo' to a transaction with a extra parameter to Transfer or TransferFrom methods
  • Unregistered account check - accounts that are not registered can not do transactions, register them first with Activate chaincode method

Demo

Set up the network via development tool (Hurley) or manual set up via the official document

Install & instantiate the chaincode on the network

chaincodes are placed inside a separated Docker container

total supply of tokens are equal to the miner's (chaincode caller) account

try to transfer some tokens to another account --> error due to the target user is not 'activated'

'activate' said account

transfer success!


Offline Unit Testing

Manually apply this patch for ABAC testing with mockStub (change line 69 & 361 like the patch in file loyalty-token-hf\hlt\go_workspace\src\github.com\hyperledger\fabric\core\chaincode\shim\mockstub.go), after you've installed Go chaincode libraries of course

Get Ginkgo test framework

go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega/...

Execute go test -v to run the test suites without the need to start up the block chain


For details please read into sample_token.go

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL