For the sake of answering this question (though I have replied to you elsewhere already on this topic); The transaction format is not just a simple SCALE encoding of some details. In rust pseudocode, a transaction will have roughly this format
// Length in bytes of the extrinsic data to follow:
let byte_len = <Compact<u32>>::decode(input)?;
// decode a byte consisting of the bits 0bABBBBBBB.
// - if A is 1, a signature follows, and if it is 0 there is no signature
// - the bits B decode to the transaction protocol version, currently 4.
let version_and_sig = u8::decode(input)?;
let is_signature = (version_and_sig & b10000000) > 0;
if (is_signature) {
let from_address = <MultiAddress<AccountId32,u32>>::decode(input)?;
let signature = MultiSignature::decode(input)?; // Prob an SR25519 signature
// Extra information is variable and actually depends on the chain;
// the below example is for polkadot, last I checked (a while ago).
// - era (ie is transaction mortal or immortal, and how long will it last?
// - nonce (how many prior transactions from the from_address?
// - tip (a tip to the block author, which can be 0)
let (era, nonce, tip): (Era, Compact<u32>, Compact<u128>)::decode(input)?;
}
// Now, we're decoding the Call enum, which looks something like
// `Pallet::Foo(Call::Something(1, true))`. Enum indexes are currently scale
// encoded to u8's. Often we want to get at least the pallet index, so that we
// can look up in the Metadata how to decode the rest.
let pallet_index = u8::decode(input)?;
let call_index = u8::decode(input)?;
let call_params = decode_call_params(metadata, pallet_index, call_index, input)?;
In other words, a transaction begins with its compact encoded length in bytes, and then has a byte which is not SCALE encoded and has 1 bit for "will a signature follow" and 7 bits for "what is the transaction protocol version we're using here".
After manually decoding that byte you can write logic to SCALE decode the signature (if present) or skip straight to SCALE decoding the call data (if signature isn't present).
The call data cannot be decoded into a vector of bytes; conceptually it is more like a SCALE encoded enum whose outer variant is the pallet you're making a call into, and inner variant is the call you're making and any parameters that you need to pass to it. One way to decode the call data is to decode a singel u8
(corresponding to the outer enum variant tag) to see what the pallet index the call is for, and then digging up information about the call enum from the metadata and using that to decode the rest of the call data.
Have a look at the decode_extrinsic
implementation for an example of how one might decode an extrinsic using runtime metadata.
Ultimately though, depending on your use case you may prefer to use a library like Subxt, which allows you to build and submit extrinsics, access node storage and subscribe/decode events. There is a bunch of stuff to work out if you want to manually figure out how to encode and decode these things (transactions, events, storage keys and results) yourself, and much of it isn't well documented, so using a library like Subxt will probably get you there much quicker.
polkadot_metadata.scale
and trying again?