Skip to content
🎉 Welcome to the new Aptos Docs! Click here to submit feedback!
Build
BCS Format

Binary Canonical Serialization (BCS) Format

All transaction arguments for the Aptos Go SDK are encoded as bytes in Binary Canonical Serialization (BCS) format. This is the format the Aptos chain recognizes, with specific types (ex. Instead of an uint64 or big.Int, it uses types like u64 or u128)

You can directly use the BCS format to build transactions by specifying argument types explicitly like so:

example.go
	accountBytes, err := bcs.Serialize(&bob.Address)
	if err != nil {
		panic("Failed to serialize bob's address:" + err.Error())
	}
 
	amountBytes, err := bcs.SerializeU64(TransferAmount)
	if err != nil {
		panic("Failed to serialize transfer amount:" + err.Error())
	}
	rawTxn, err := client.BuildTransaction(alice.AccountAddress(), aptos.TransactionPayload{
		Payload: &aptos.EntryFunction{
			Module: aptos.ModuleId{
				Address: aptos.AccountOne,
				Name:    "aptos_account",
			},
			Function: "transfer",
			ArgTypes: []aptos.TypeTag{},
			Args: [][]byte{
				accountBytes,
				amountBytes,
			},
		}},
	)

You can learn more about BCS by exploring the BCS GitHub repo.