id | title |
---|---|
examples |
Examples |
{% hint style="danger" %} WARNING! This package is deprecated and is no longer maintained and supported. {% endhint %}
using ARKEcosystem.Client;
using ARKEcosystem.Client.API;
static void Main(string[] args)
{
ConnectionManager.Connect(new Connection("http://my.node.ip:port/api/", "main"))
}
This service API grants access to the blocks resource. A block is a signed set of transactions created by a delegate and permanently committed to the ARK blockchain.
It is not possible to
POST
a block through the public API. Relay Nodes accept only blocks posted by a delegate at the correct time through the internal API.
var blocks = ConnectionManager.Connection("main").Api.Blocks.All();
>>> {'meta': {'count': 10, ... }}
var block = ConnectionManager.Connection("main").Api.Blocks.Show("validBlockId");
>>> {'data': {'id': 'validBlockId' ... }}
var blockTransactions = ConnectionManager.Connection("main").Api.Blocks.Transactions("validBlockId");
>>> {'meta': {'count': 10, ... }}
var parameters = new Dictionary<string, string> {
{"id": "validBlockId"}
}
var searchedBlocks = ConnectionManager.Connection("main").Api.Blocks.Search(parameters);
>>> {'meta': {'count': 100, ... }}
The client SDK can be used to query the delegate resource.
A delegate is a regular wallet that has broadcasted a registration transaction, acquired a sufficient number of votes, and has a Relay Node configured to forge new blocks through a forger
module. At any time only 51 delegates are active. They are cost-efficient miners running the ARK network.
Voters are wallets which have broadcasted a vote transaction on a delegate. A vote remains active until an un-vote transaction is sent (it does not have to be recast unless a wallet wishes to change from delegate). Voting for a delegate does not give the delegate access to the wallet nor does it lock the coins in it.
var delegates = ConnectionManager.Connection("main").Api.Delegates.All();
>>> {'meta': {'count': 20, ... }}
var delegate = ConnectionManager.Connection("main").Api.Delegates.Show("validId");
>>> {'data': {'username': 'delegateName', ... }}
var delegateBlocks = ConnectionManager.Connection("main").Api.Delegates.Blocks("validId");
>>> {'meta': {'count': 100, ... }}
var delegateVoters = ConnectionManager.Connection("main").Api.Delegates.voters("validId");
>>> {'meta': {'count': 10, ... }}
The ARK network consists of different anonymous nodes (servers), maintaining the public ledger, validating transactions and blocks and providing APIs. The node resource allows for querying the health and configurations of the node used by the instantiated client.
var nodeConfiguration = ConnectionManager.Connection("main").Api.Node.Configuration();
>>> {'data': {'nethash': '6e84d08bd299ed97c212c886c98a57e36545c8f5d645ca7eeae63a8bd62d8988', ... }}
var nodeStatus = ConnectionManager.Connection("main").Api.Node.Status();
>>> {'data': {'synced': True, 'now': 6897158, 'blocksCount': -1}}
var nodeSyncingStatus = ConnectionManager.Connection("main").Api.Node.Syncing();
>>> {'data': {'syncing': False, 'blocks': -1, 'height': 6897160, 'id': '12905037940821862953'}}
Each node is connected to a set of peers, which are Relay or Delegate Nodes as well. The peers resource provides access to all peers connected to our node.
Peers have made their Public API available for use; however for mission-critical queries and transaction posting you should use a node which is under your control. We provide a guide to setting up a Relay Node here.
var peers = ConnectionManager.Connection("main").Api.Peers.All();
>>> {'meta': {'count': 100, ... }}
var peer = ConnectionManager.Connection("main").Api.Peers.Show("validIpAddress");
>>> {'data': {'count': 20, ... }} # Need to changes
The heart of any blockchain is formed by its transactions; state-altering payloads signed by a wallet. Most likely you will be querying for transactions most often, using the transaction resource.
A transaction is the only object which may be posted by a non-delegate. It requires a signature from a wallet containing a sufficient amount of ARK.
var parameters = new Dictionary<string, dynamic>
{
{
"amount: 1,
...
}
};
var transaction = ConnectionManager.Connection("main").Api.Transactions.Create(parameters);
>>> ...
var transaction = ConnectionManager.Connection("main").Api.Transactions.Show("validId");
>>> ...
var transactions = ConnectionManager.Connection("main").Api.Transactions.All();
>>> {'meta': {'count': 10, ... }}
var unconfirmedTransactions = ConnectionManager.Connection("main").Api.Transactions.AllUnconfirmed();
>>> {'meta': {'count': 10, ... }}
var unconfirmedTransaction = ConnectionManager.Connection("main").Api.Transactions.ShowUnconfirmed("validId");
>>> ...
var parameters = new Dictionary<string, string>
{
{
"amount", 1
}
};
var searchedTransactions = ConnectionManager.Connection("main").Api.Transactions.Search(parameters);
>>> {'meta': {'count': 10, ... }}
var transactionTypes = ConnectionManager.Connection("main").Api.Transactions.Types();
>>> {"data":{...}}
A vote is a transaction sub-type, where the asset
field contains a votes
object and the transaction.type
is 3
.
var votes = ConnectionManager.Connection("main").Api.Votes.All();
>>> {'meta': {'count': 10, ... }}
var vote = ConnectionManager.Connection("main").Api.Votes.Show("validId");
>>> {'data': {...}}
The wallet resource provides access to:
- Wallets.
- Incoming and outgoing transactions per wallet.
- Each wallet's votes.
var wallets = ConnectionManager.Connection("main").Api.Wallets.All();
>>> {'meta': {'count': 10, ... }}
var wallet = ConnectionManager.Connection("main").Api.Wallets.Show("validId");
>>> {'data': {'address': 'validWalletAddress' ... }}
var walletTransactions = ConnectionManager.Connection("main").Api.Wallets.Transactions("validId");
>>> {'meta': {'count': 10, ... }}
var receivedTransactions = ConnectionManager.Connection("main").Api.Wallets.ReceivedTransactions();
>>> {'meta': {'count': 10, ... }}
var sentTransactions = ConnectionManager.Connection("main").Api.Wallets.SentTransactions();
>>> {'meta': {'count': 10, ... }}
var walletVotes = ConnectionManager.Connection("main").Api.Wallets.Votes();
>>> {'meta': {'count': 10, ... }}
var topWallets = ConnectionManager.Connection("main").Api.Wallets.Top();
>>> {'meta': {'count': 10, ... }}
var parameters = new Dictionary<string, string>
{
{
"username", "dummy"
}
};
var searchedWallets = ConnectionManager.Connection("main").Api.Wallets.Search(parameters);
>>> {'meta': {'count': 10, ... }}