Giter VIP home page Giter VIP logo

ckb-std's Introduction

ckb-std

Crates.io

This library contains several modules that help you write CKB contract with Rust.

Usage

Documentation

Modules

  • syscalls module: defines CKB syscalls
  • high_level module: defines high level APIs
  • dynamic_loading module: dynamic loading primitives
  • debug! macro: a println! like macro helps debugging
  • entry! macro: defines contract entry point
  • default_alloc! macro: defines global allocator for no-std rust

Memory allocator

Default allocator uses a mixed allocation strategy:

  • Fixed block heap, only allocate fixed size(64B) memory block
  • Dynamic memory heap, allocate any size memory block

User can invoke macro with arguments to customize the heap size. The default heap size arguments are:

(fixed heap size 4KB, dynamic heap size 516KB, dynamic heap min memory block 64B)

Use the macro with arguments to change it:

default_alloc!(4 * 1024, 516 * 1024, 64)

Beware, use difference heap size or memory block size may affect the verification result of the contract, some runtime errors such as out of memory may occur; you should always test the contract after customizing.

Examples

Check examples and tests to learn how to use.

See also ckb-tool which helps you write tests.

ckb-std's People

Contributors

jjyr avatar xxuejie avatar thewawar avatar mohanson avatar xujiandong avatar quake avatar blckngm avatar joii2020 avatar ethanyuan avatar doitian avatar aimeedeer avatar cupnfish avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.