Points Program: Earn rewards and contribute to the Fuel Network.Learn more →

Account

0x00000000000000000000000035CdBfDcC9d4BDf07F63E142EA80BE2712Be13Eb0x0000...13Eb

Solana Connector
This connector supports SVM compatible EOA accounts such as Phantom and Backpack.

Source Code
predicate;

use std::{
    b512::B512,
    constants::ZERO_B256,
    hash::{
        Hash,
        sha256,
    },
    ecr::{
        EcRecoverError,
        ed_verify,
    },
    tx::{
        tx_id,
        tx_witness_data,
    },
    bytes::Bytes,
};

const ASCII_MAP: [u8; 16] = [
    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102
];

pub fn b256_to_ascii_bytes(val: b256) -> Bytes {
    let bytes = Bytes::from(val);
    let mut ascii_bytes = Bytes::with_capacity(64);
    let mut idx = 0;

    while idx < 32 {
        let b = bytes.get(idx).unwrap();
        ascii_bytes.push(ASCII_MAP[(b >> 4).as_u64()]);
        ascii_bytes.push(ASCII_MAP[(b & 15).as_u64()]);
	    idx = idx + 1;
    }

    ascii_bytes
}

configurable {
    SIGNER: b256 = ZERO_B256,
}

fn main(witness_index: u64) -> bool {
    let signature: B512 = tx_witness_data(witness_index).unwrap();
    let encoded = b256_to_ascii_bytes(tx_id());
    let result = ed_verify(SIGNER, signature, encoded);

    if result.is_ok() {
        return true;
    }

    // Otherwise, an invalid signature has been passed and we invalidate the Tx.
    false
}
Bytecode
0x1a403000504100301a445000ba49000032400481504100205d490000504100083240048220451300524510044a4400003ac5c446f2f99d83d0e2dc773bb77c619783f1389c4d0198bba9b48680b8017700000000000000405b2f69871f6d3619c1cb21993714331ed53aae21f8221990c1b97eb2ede6575330313233343536373839616263646566cccccccccccc00020000000000000330