Implementing Milestones

Milestones are objects that dictate how ARK Core behaves after certain heights are reached. Lets have a look at the mainnet milestones to understand this better.

1[
2 {
3 "height": 1,
4 "reward": 0,
5 "activeDelegates": 51,
6 "blocktime": 8,
7 "block": {
8 "version": 0,
9 "maxTransactions": 50,
10 "maxPayload": 2097152,
11 "acceptExpiredTransactionTimestamps": true
12 },
13 "epoch": "2017-03-21T13:00:00.000Z",
14 "fees": {
15 "staticFees": {
16 "transfer": 10000000,
17 "secondSignature": 500000000,
18 "delegateRegistration": 2500000000,
19 "vote": 100000000,
20 "multiSignature": 500000000,
21 "ipfs": 500000000,
22 "multiPayment": 10000000,
23 "delegateResignation": 2500000000,
24 "htlcLock": 10000000,
25 "htlcClaim": 0,
26 "htlcRefund": 0
27 }
28 },
29 "vendorFieldLength": 64
30 },
31 {
32 "height": 75600,
33 "reward": 200000000
34 },
35 {
36 "height": 6600000,
37 "block": {
38 "maxTransactions": 150,
39 "maxPayload": 6300000
40 }
41 },
42 {
43 "height": 8128000,
44 "vendorFieldLength": 255
45 },
46 {
47 "height": 8204000,
48 "block": {
49 "idFullSha256": true
50 }
51 }
52]

The first milestone starts at height 1, which is the genesis block which gets generated when you create a new network configuration.

1{
2 "height": 1,
3 "reward": 0, // Each forged block yields 0 rewards for the forger
4 "activeDelegates": 51, // 51 delegates can forge at any given time
5 "blocktime": 8, // Time in which a block is expected to be forged
6 "block": {
7 "version": 0,
8 "maxTransactions": 50, // Maximum of transactions allowed to be forged per block
9 "maxPayload": 2097152, // Maximum size of a block in bytes
10 "acceptExpiredTransactionTimestamps": true
11 },
12 "epoch": "2017-03-21T13:00:00.000Z", // Start time of the network
13 "fees": {
14 "staticFees": {
15 "transfer": 10000000, // Fee for type 0
16 "secondSignature": 500000000, // Fee for type 1
17 "delegateRegistration": 2500000000, // Fee for type 2
18 "vote": 100000000, // Fee for type 3
19 "multiSignature": 500000000, // Fee for type 4
20 "ipfs": 500000000, // Fee for type 5
21 "multiPayment": 10000000, // Fee for type 6
22 "delegateResignation": 2500000000, // Fee for type 7
23 "htlcLock": 10000000, // Fee for type 8
24 "htlcClaim": 0, // Fee for type 9
25 "htlcRefund": 0 // Fee for type 10
26 }
27 },
28 "vendorFieldLength": 64 // Maximum length of the vendor field for type 0 transactions
29}

This first milestone serves as the base for all future milestones. Lets take a look at what below milestones do.

1[
2 {
3 // From height 75600 onwards we will reward 2 ARK for every forged block
4 "height": 75600,
5 "reward": 200000000
6 },
7 {
8 // From height 6600000 onwards we will allow 150 transactions
9 // to be forged per block with a maximum size of 6300000 bytes
10 "height": 6600000,
11 "block": {
12 "maxTransactions": 150,
13 "maxPayload": 6300000
14 }
15 },
16 {
17 // From height 8128000 onwards we will allow the vendor field
18 // for type 0 transactions to be 255 characters long
19 "height": 8128000,
20 "vendorFieldLength": 255
21 },
22 {
23 // From height 8204000 onwards we will require that
24 // all block IDs are SHA256 strings instead of numerical IDs
25 "height": 8204000,
26 "block": {
27 "idFullSha256": true
28 }
29 }
30]

Each future milestone will be merged with its predecessors to ensure all values necessary are present.

Working With Milestones

Sometimes you might have the need to get a milestone for a specific height or need all of them to perform some statistical calculations. The @arkecosystem/crypto package makes this easy through its configuration manager that manages the state of the configuration and related milestones.

Getting All Milestones

1import { Managers } from "@arkecosystem/config";
2 
3const milestones: object[] = Managers.configManagers.getMilestones();

Getting The Milestone For A Given Height

1import { Managers } from "@arkecosystem/config";
2 
3const milestone: object = Managers.configManagers.getMilestone(75600);

Determining If A Given Height Is A Milestone

1import { Managers } from "@arkecosystem/config";
2 
3const isNewMilestone: boolean = Managers.configManagers.isNewMilestone(75600);
Last updated 3 years ago
Edit Page
Share: