ASMB API
引用:https://github.com/asmbio/doc/blob/master/api.mdASMB API簡介接口列表接口實現基于接口開發的app(MaonsASMB API簡介接口是
引用:https://github.com/asmbio/doc/blob/master/api.md
- ASMB API
- 簡介
- 接口列表
- 接口實現
- 基于接口開發的app(Maons
ASMB API
簡介
接口是基于 filecoin jsonrpc 開發的,符合josnrpc2.0 規范,目前已經實現的client有Go,C#兩種。
接口列表
Getchaininfo(ctx context.Context) (*Chaininfo, error) //perm:readnGetLastblock(ctx context.Context, h uint64, slice []byte) (*SignBlockHeader, error) //perm:readnGetLastblockLR(ctx context.Context, h uint64, lr string) (*SignBlockHeader, error) //perm:readnGetPengdingMsgs(ctx context.Context, n int) ([]Messagebs, error) //perm:readnVdHash(ctx context.Context, hash []byte, slice1 []byte) (*SignBlockHeader, error) //perm:signnGetAccount(ctx context.Context, address []byte) (*StateAccount, error) //perm:signnGetReceipt(ctx context.Context, addr []byte, rcpkey []byte, t uint64) ([]byte, error) //perm:signnGetReceipts(ctx context.Context, addr []byte, t uint64, n int) ([]Messagebs, error) //perm:signnGetAccounts(ctx context.Context, addr []byte, n int) (map[string]*StateAccount, error) //perm:signnGetAccountsbyft(ctx context.Context, hash, addrf, addrt []byte, n int) (map[string]*StateAccount, error) //perm:signnPubmsg(ctx context.Context, transmsg Messagebs) error //perm:signnVdMsgRequest(ctx context.Context, msgbs Messagebs) error //perm:signnGetBlockbyHS(ctx context.Context, h uint64, s []byte) (*SignBlockHeader, error) //perm:signnGetBlocks(ctx context.Context, h uint64, hash, s []byte, n int) ([]*SignBlockHeader, error) //perm:signtnAskNil(ctx context.Context, addr []byte) error //perm:signnEnEgg1Code(ctx context.Context) (Egg1msg, error) //perm:readnDeEgg1Code(ctx context.Context, Randomcode []byte, Time uint64) ([]byte, error) n
接口實現
接口實現分兩部分:
第一部分,根據地址空間查找分片的服務地址(才能獲得最新的數據);
第二部分,調用查找到服務地址開放的api
參考C#實現NASMB: https://github.com/asmbio/NASMB
var aRpcClient = Fullapi.FindSliceApiService(AConst.MaxSlice);nn var ret = await aRpcClient.SendRequestAsync<object>("GetBlockbyHS", null, 1, AConst.MaxSlice);
基于接口開發的app(Maons
目前Maons就是基于NASMB 開發app,目前Maons需要依托一個完整觀察鏈,后面Maons也會作為一個獨立觀察節點,只觀察錢包地址相關的分片數據,獨立分析驗證最新區塊,并展示給用戶.







