Skip to content

MetaID-Labs/metaid-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metaid-parser

What is metaid-parser?

This is a tool designed for parsing MetaID data. It can parse transaction data from the blockchain into an object, making it convenient for subsequent operations. By referencing this tool, you can create your own MetaID transaction data parsing tool.

How to use metaid-parser?

  1. Introducing metaid-parser
 go get github.com/metaid-chain/metaid-parser
  1. Using metaid-parser
import (
    "github.com/metaid-chain/metaid-parser"
)

func main() {
    // Retrieve metaid transaction data from the blockchain.
    raw := "0a0000000196e50f526c845d9ea56ae439caf45fac0c55cf93847ffb760e5bad2c5e28789e000000006b483045022100d3887526dd1f533e7eecb431c6c75834a508577d779bddf2d11f638e7388340002201e720d9dcc9eb66c7586fa0af7c376f4a577cdf594758d42cb71330025e67f61c12102f99ddf46677a379d45adc9e448a66183c986e5f723f74628b44922a555c6be9fffffffff0422020000000000001976a9145bd8e061781b56d50f17d3f47cf49e95cd966b3588ac0000000000000000fdf101006a036d7663423032343931386639643833316138636165346462323539333639663331653162366631366533323337326163663964663335626330306130636131636532326361624031613330663863376165316165346366363131363233363632376438333839623938383935363831623735393465336161386262353063356139326332346532066d65746169641c53696d706c654d6963726f626c6f672d3032343931386639643833314d27017b22636f6e74656e74223a2223e880b6e8b7afe69292e586b75c5c6e5c5c6ee4baabe58f97e4bd8fe59ca8e59ca3e59f8ee79a84e88da3e8aa89efbc8ce5b0b1e5be97e689bfe58f97e2809ce59ca3e2809de5b8a6e69da5e79a84e781bee99abee38082e8bf99e4b99fe5be88e585ace5b9b3e38082222c22636f6e74656e7454797065223a22746578745c2f706c61696e222c2271756f74655478223a22222c226174746163686d656e7473223a5b226d65746166696c653a2f2f63303761356633626230383835623034313435666133396436323334353333393263386235663135626566616430313565373332663564323037616333643765225d2c226d656e74696f6e223a5b5d2c2263726561746554696d65223a313639363930383537303839327d013005312e302e330a746578742f706c61696e055554462d38dfd67b30050000001976a91487d4c955f87ce795a5a8d919e429244d4bcd7bb488ac00000000000000000e006a0b616e64726f696453686f7700000000"
	bytes, _ := hex.DecodeString(raw)
	
    // Parse metaid transaction data.
    dataPart, scriptHex, vouts, vins, status := metaid.DecodeTxToDataPart(bytes)
	fmt.Printf("%+v\n", dataPart)
	fmt.Println(scriptHex)
	fmt.Println(status)
	for _, v := range vouts {
		fmt.Println(*v)
	}
	for _, v := range vins {
		fmt.Println(*v)
	}
}