Chain

The Chain method group contains methods for interacting with the blockchain, but that do not require any form of state computation.

chainDeleteObj

chainDeleteObj (cid: Cid): Promise<void>

Deletes node referenced by the given CID

Parameters:

Returns:

Promise<void>

Source: index.d.ts, line 160, character 16

chainExport

chainExport (handler: (data: string) => void, chainEpoch: number, bool: boolean, tipSetKey: Cid[]): [() => void, Promise<void>]

Returns a stream of bytes with CAR dump of chain data. The exported chain data includes the header chain from the given tipset back to genesis, the entire genesis state, and the most recent 'nroots' state trees. If oldmsgskip is set, messages from before the requested roots are also not included.

Parameters:

  • handler: (data: string) => void
  • chainEpoch: number
  • bool: boolean
  • tipSetKey: Cid[]

Returns:

[() => void, Promise<void>]

Source: index.d.ts, line 168, character 13

chainGetBlock

chainGetBlock (cid: Cid): Promise<BlockHeader>

Returns the block specified by the given CID.

Parameters:

Returns:

Promise<BlockHeader>

Source: index.d.ts, line 172, character 15

chainGetBlockMessages

chainGetBlockMessages (cid: Cid): Promise<BlockMessages>

Returns messages stored in the specified block.

Parameters:

Returns:

Promise<BlockMessages>

Source: index.d.ts, line 176, character 23

chainGetGenesis

chainGetGenesis (): Promise<TipSet>

Returns the genesis tipset.

Returns:

Promise<TipSet>

Source: index.d.ts, line 180, character 17

chainGetMessage

chainGetMessage (cid: Cid): Promise<Message>

Reads a message referenced by the specified CID from the chain blockstore.

Parameters:

Returns:

Promise<Message>

Source: index.d.ts, line 185, character 17

chainGetNode

chainGetNode (str: string): Promise<IpldObject>

Parameters:

  • str: string

Returns:

Promise<IpldObject>

Source: index.d.ts, line 186, character 14

chainGetParentMessages

chainGetParentMessages (cid: Cid): Promise<Array<Message1>>

Returns messages stored in parent tipset of the specified block.

Parameters:

Returns:

Promise<Array<Message1>>

Source: index.d.ts, line 191, character 24

chainGetParentReceipts

chainGetParentReceipts (cid: Cid): Promise<Array<MessageReceipt>>

Returns receipts for messages in parent tipset of the specified block.

Parameters:

Returns:

Promise<Array<MessageReceipt>>

Source: index.d.ts, line 196, character 24

chainGetPath

chainGetPath (tipSetKey: Cid[], tipSetKey1: Cid[]): Promise<Array<HeadChange>>

Returns a set of revert/apply operations needed to get from one tipset to another, for example:

       to
        ^
from   tAA
  ^     ^
tBA    tAB
 ^---*--^
     ^
    tRR

Would return [revert(tBA), apply(tAB), apply(tAA)]

Parameters:

  • tipSetKey: Cid[]
  • tipSetKey1: Cid[]

Returns:

Promise<Array<HeadChange>>

Source: index.d.ts, line 212, character 14

chainGetRandomnessFromBeacon

chainGetRandomnessFromBeacon (tipSetKey: Cid[], domainSeparationTag: number, chainEpoch: number, bytes: string): Promise<string>

Is used to sample the beacon for randomness.

Parameters:

  • tipSetKey: Cid[]
  • domainSeparationTag: number
  • chainEpoch: number
  • bytes: string

Returns:

Promise<string>

Source: index.d.ts, line 216, character 30

chainGetRandomnessFromTickets

chainGetRandomnessFromTickets (tipSetKey: Cid[], domainSeparationTag: number, chainEpoch: number, bytes: string): Promise<string>

Is used to sample the chain for randomness.

Parameters:

  • tipSetKey: Cid[]
  • domainSeparationTag: number
  • chainEpoch: number
  • bytes: string

Returns:

Promise<string>

Source: index.d.ts, line 220, character 31

chainGetTipSet

chainGetTipSet (tipSetKey: Cid[]): Promise<TipSet>

Returns the tipset specified by the given TipSetKey.

Parameters:

  • tipSetKey: Cid[]

Returns:

Promise<TipSet>

Source: index.d.ts, line 224, character 16

chainGetTipSetByHeight

chainGetTipSetByHeight (chainEpoch: number, tipSetKey: Cid[]): Promise<TipSet>

Looks back for a tipset at the specified epoch. If there are no blocks at the specified epoch, a tipset at an earlier epoch will be returned.

Parameters:

  • chainEpoch: number
  • tipSetKey: Cid[]

Returns:

Promise<TipSet>

Source: index.d.ts, line 230, character 24

chainHasObj

chainHasObj (cid: Cid): Promise<boolean>

Checks if a given CID exists in the chain blockstore.

Parameters:

Returns:

Promise<boolean>

Source: index.d.ts, line 234, character 13

chainHead

chainHead (): Promise<TipSet>

Returns the current head of the chain.

Returns:

Promise<TipSet>

Source: index.d.ts, line 238, character 11

chainNotify

chainNotify (handler: (data: Array<HeadChange>) => void): [() => void, Promise<void>]

Returns channel with chain head updates. First message is guaranteed to be of len == 1, and type == 'current'.

Parameters:

Returns:

[() => void, Promise<void>]

Source: index.d.ts, line 243, character 13

chainReadObj

chainReadObj (cid: Cid): Promise<string>

Reads ipld nodes referenced by the specified CID from chain blockstore and returns raw bytes.

Parameters:

Returns:

Promise<string>

Source: index.d.ts, line 248, character 14

chainSetHead

chainSetHead (tipSetKey: Cid[]): Promise<void>

Forcefully sets current chain head. Use with caution.

Parameters:

  • tipSetKey: Cid[]

Returns:

Promise<void>

Source: index.d.ts, line 252, character 14

chainStatObj

chainStatObj (cid: Cid, cid1: Cid): Promise<ObjStat>

Returns statistics about the graph referenced by 'obj'. If 'base' is also specified, then the returned stat will be a diff between the two objects.

Parameters:

Returns:

Promise<ObjStat>

Source: index.d.ts, line 258, character 14

chainTipSetWeight

chainTipSetWeight (tipSetKey: Cid[]): Promise<string>

Computes weight for the specified tipset.

Parameters:

  • tipSetKey: Cid[]

Returns:

Promise<string>

Source: index.d.ts, line 262, character 19