massa
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)
x
executeReadOnlyCallx
getBlocksx
getDataStoreEntriesx
getNextBlockBestParentsx
getOperationsx
getScExecutionEventsx
getSelectorDrawx
getStakersx
getStatusx
getTransactionThroughputx
queryStatex
newBlocksx
newEndorsementsx
newFilledBlocksx
newOperationsx
newSlotExecutionOutputsx
sendBlocksx
sendEndorsementsx
sendOperationsx
transactionThroughput
GRPC Private API (node_ip:33038)
x
addToBootstrapBlacklistx
addToBootstrapWhitelistx
addToPeersWhitelistx
addStakingSecretKeysx
allowEveryoneToBootstrapx
banNodesByIdsx
banNodesByIpsx
getBootstrapBlacklistx
getBootstrapWhitelistx
getMipStatusx
getNodeStatusx
getPeersWhitelistx
removeFromBootstrapBlacklistx
removeFromBootstrapWhitelistx
removeFromPeersWhitelistx
removeStakingAddressesx
signMessagesx
shutdownGracefullyx
unbanNodesByIdsx
unbanNodesByIps
JSONRPC Public API (node_ip:33035)
x
get_addressesx
get_blocksx
get_blockclique_block_by_slotx
get_cliquesx
get_endorsementsx
get_graph_intervalx
get_operationsx
get_stakersx
get_statusx
send_operations - send transactionx
send_operations - buy rollsx
send_operations - sell rollsx
send_operations - execute smart contract
Getting started
Check usage in /example
folder to test some examples:
To run the examples, follow the following steps:
- Navigate to the example folder and open
constants.dart
. - 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.
- 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.
- Request test tokens from massa discord server.
- 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.
Links
- Massa: Massa main website
- Massa Foundation website
- Testnet: Massa testnet
- Massa buildnet
- Massa station
- Massa Documentation: Valuable massa documentation
- Massa Github: Massa official github repository
- Massa Web3: massa-dart will have similar functionalities as massa-web3
- Massa Dart SDK documentation
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.