Skip to content

dusk-network/wallet-core

Wallet Core

status codecov documentation

A WASM library to provide business logic for Dusk wallet implementations.

Check the available methods under the FFI module.

Every function expects a fat pointer to its arguments already allocated to the WASM memory. For the arguments definition, check the JSON Schema. It will consume this pointer region and free it after execution. The return of the function will also be in accordance to the schema, and the user will have to free the memory himself after fetching the data.

For maximum compatibility, every WASM function returns a i64 with the status of the operation and an embedded pointer. The structure of the bytes in big-endian is as follows:

[(pointer) x 4bytes (length) x 3bytes (status) x 1bit]

The pointer will be a maximum u32 number, and the length a u24 number. The status of the operation is the least significant bit of the number, and will be 0 if the operation is successful.

Here is an algorithm to split the result into meaningful parts:

let ptr = (result >> 32) as u64;
let len = ((result << 32) >> 48) as u64;
let success = ((result << 63) >> 63) == 0;

For an example usage, check the wallet-cli implementation that consumes this library.

Requirements

Build

To build a distributable package:

make package

Test

To run the tests, there is an automated Makefile script

make test

About

The library responsible for the core functionality of a wallet

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages