massa 1.9.7 copy "massa: ^1.9.7" to clipboard
massa: ^1.9.7 copied to clipboard

Massa package is an SDK that connects your Dart and Flutter applications to the Massa blockchain, create wallet, send transactions, and work with smart contracts.

massa #

pub.dev Stars Issues MIT License

Massa is a public blockchain and protocol that aims to deliver decentralization, scale and security for many people. It uses PROOF OF STAKE consensus mechanism to ensures full participation, protection, and high transaction throughput.

Introduction #

Massa-dart is an SDK that is able to connect your Dart and Flutter applications to the Massa blockchain, create wallet, send transactions, and work with smart contracts.

Features #

This package will allows you to interact with massa blockchain using the folloiwng public and privated grpc and jsonrpc methods.

GRPC Public API (node_ip:33037) #

  • ✅ executeReadOnlyCall
  • ✅ getBlocks
  • ✅ getDataStoreEntries
  • ✅ getNextBlockBestParents
  • ✅ getOperations
  • ✅ getScExecutionEvents
  • ✅ getSelectorDraw
  • ✅ getStakers
  • ✅ getStatus
  • ✅ getTransactionThroughput
  • ✅ queryState
  • ✅ newBlocks
  • ✅ newEndorsements
  • ✅ newFilledBlocks
  • ✅ newOperations
  • ✅ newSlotExecutionOutputs
  • ✅ sendBlocks
  • ✅ sendEndorsements
  • ✅ sendOperations
  • ✅ transactionThroughput

GRPC Private API (node_ip:33038) #

  • ✅ addToBootstrapBlacklist
  • ✅ addToBootstrapWhitelist
  • ✅ addToPeersWhitelist
  • ✅ addStakingSecretKeys
  • ✅ allowEveryoneToBootstrap
  • ✅ banNodesByIds
  • ✅ banNodesByIps
  • ✅ getBootstrapBlacklist
  • ✅ getBootstrapWhitelist
  • ✅ getMipStatus
  • ✅ getNodeStatus
  • ✅ getPeersWhitelist
  • ✅ removeFromBootstrapBlacklist
  • ✅ removeFromBootstrapWhitelist
  • ✅ removeFromPeersWhitelist
  • ✅ removeStakingAddresses
  • ✅ signMessages
  • ✅ shutdownGracefully
  • ✅ unbanNodesByIds
  • ✅ unbanNodesByIps

JSONRPC Public API (node_ip:33035) #

  • ❌ execute_read_only_bytecode
  • ❌ execute_read_only_call
  • ✅ get_addresses
  • ✅ get_blocks
  • ✅ get_blockclique_block_by_slot
  • ✅ get_cliques
  • ❌ get_datastore_entries
  • ❌ get_datastore_entry
  • ✅ get_endorsements
  • ❌ get_filtered_sc_output_event
  • ✅ get_graph_interval
  • ✅ get_operations
  • ✅ get_stakers
  • ✅ get_status
  • ✅ send_operations - send transaction
  • ✅ send_operations - buy rolls
  • ✅ send_operations - sell rolls
  • ✅ send_operations - execute smart contract
  • ❌ send_operations - call smart contract

Getting started #

Check usage in /example folder to test some examples: To run the examples, follow the following steps:

  1. Navigate to the example folder and open constants.dart.
  2. Replace grpc address and port, e.g address: test.massa.net', grpc port: 33037. Note this information may be changed as Massa Blockchain Technology development progresses. Check the correct information on Massa Documentation Website. Further note that, testnet or buildernet must be active for some examples to work, depending on your grpc configuration.
  3. Generate private key and address using Massa Station, Bearby, or by running the test in the section below. Please do not use your massa mainnet address for testing purposes.
  4. Request test tokens from massa discord server.
  5. To run a specific example, navigate to the given folder, and run the command dart run example_filename.dart

NOTE that all examples are tested and working with MASSA DEVNET 27.3.

Testing #

To run the test cases, navigate to the project root folder and run dart test You need to have flutter/dart sdk installed in your machine. Please note that for grpc test, you need to configure grpc address and port. For some test, e.g getOperation test, you need to provide correct operation. Without proding correct information, grpc test will likely fail.

Usage #

View more examples in /example folder.

NOTE: For smart contract examples, all the smart contracts are already deployed on the buildnet, so you do not need to deploy them.

The example below shows how to get list of stakers

import 'package:massa/massa.dart';

Future<void> main() async {
  const ipAddress = 'buildnet.massa.net';
  const port = 33037;
  var grpc = GRPCPublicClient(ipAddress, port);
  final stakers = await grpc.getStakers(limit: Int64(10));
  if (stakers.isEmpty) {
    print('No stakers found');
    return;
  }

  final totalAddresses = stakers.length;
  Int64 totalRolls = Int64(0);
  for (var staker in stakers) {
    print('${staker.address}:${staker.rolls}');
    totalRolls += staker.rolls;
  }
  print('Total addresses: $totalAddresses');
  print('Total rolls: $totalRolls');
  await grpc.shutDown();
}

Additional information #

You can get more information about massa by visiting the links below.

Support #

This project is supported by massa

Contribute #

You can contribute to this package, request new features or report any bug by visiting the package repository at massa-dart

License #

The MIT License (MIT). Please see License File for more information.

4
likes
130
points
97
downloads

Publisher

verified publishernafsi.world

Weekly Downloads

Massa package is an SDK that connects your Dart and Flutter applications to the Massa blockchain, create wallet, send transactions, and work with smart contracts.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

base_codecs, binary, cryptography, fixnum, grpc, hex, http, pointycastle, protobuf, retry

More

Packages that depend on massa