Skip to content

Instantly share code, notes, and snippets.

@aeyakovenko
Created September 20, 2018 17:16
Show Gist options
  • Save aeyakovenko/3a1596f71f1975f2aec1963801f41ab3 to your computer and use it in GitHub Desktop.
Save aeyakovenko/3a1596f71f1975f2aec1963801f41ab3 to your computer and use it in GitHub Desktop.
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
struct Program {
/// program_id maps to an entry point
program_id: Pubkey,
/// These indecies point to Transaction::keys array and accounts for those keys will be loaded
/// for execution
keys: Vec<u8>,
/// Userdata to pass along each call
userdata: Vec<u8>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct Transaction {
/// A digital signature of `keys`, `program_id`, `last_id`, `fee` and `userdata`, signed by `Pubkey`.
pub signature: Signature,
/// The `Pubkeys` that are executing this transaction userdata. The meaning of each key is
/// program-specific.
/// * keys[0] - Typically this is the `caller` public key. `signature` is verified with keys[0].
/// In the future which key pays the fee and which keys have signatures would be configurable.
/// * keys[1] - Typically this is the program context or the recipient of the tokens
pub keys: Vec<Pubkey>,
/// The ID of a recent ledger entry.
pub last_id: Hash,
/// The number of tokens paid for processing and storage of this transaction.
pub fee: i64,
/// Execute the programs atomically
pub programs: Vec<Program>
}
@mvines
Copy link

mvines commented Sep 20, 2018

👍 , with this too:

    /// A vector of digital signature of `keys`, `program_id`, `last_id`, `fee` and `userdata`, signed by `Pubkey`.
    pub signatures: Vec<Signature>,
    /// Indecies of what key the signatures vector has signed for
    pub signed_keys: Vec<u8>,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment