On-chain since 2022
I'm Alberto Bas, a software engineer.
I design and develop end-to-end Web3 products. From smart contracts to full-stack applications, machine learning models, zero knowledge circuits...
Smart contract development
Seamlessly automate and secure transactions with smart contracts, execute agreements transparently and efficiently without the need for intermediaries.
- Languages: Solidity and Vyper.
- Frameworks: Hardhat, Foundry and Brownie
contract BottlingCompany is Initializable, BottlingPlantUpgradeable { /** * @dev Initialize function. * @param dependentToken The dependent token address. * @param industrialUnitToken The industrial unit token address. * @param escrow_ The industrial units escrow address. */ function initialize( address dependentToken, address industrialUnitToken, address escrow_) external initializer { __BottlingPlantUpgradeable_init('Bottling Company', dependentToken, industrialUnitToken, escrow_); } /// @dev See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps uint256[50] private __gap;}Subgraph development
Unlock the potential of decentralized applications with subgraph solutions to collect and aggregate data efficiently.
- Languages: GraphQL, AssemblyScript and TypeScript.
- Libraries: TheGraph.
type Account @entity(immutable: false) { id: Bytes! asCertificateContract: CertificateContract asEscrowContract: EscrowContract asMemberContract: MemberContract asTokenContract: TokenContract escrowBalance: Balance events: [IEvent!] @derivedFrom(field: "emitter") ownerOfMember: [MemberContract!] @derivedFrom(field: "owner") ownerOfCertificateContract: [CertificateContract!]! @derivedFrom(field: "owner") ownerOfEscrowContract: [EscrowContract!]! @derivedFrom(field: "owner") ownerOfTokenContract: [TokenContract!]! @derivedFrom(field: "owner") ownershipTransferred: [OwnershipTransferred!] @derivedFrom(field: "owner") tokenBalances: [Balance!] @derivedFrom(field: "tokenAccount") tokenOperatorOwner: [TokenOperator!] @derivedFrom(field: "owner") tokenOperatorOperator: [TokenOperator!] @derivedFrom(field: "operator") tokenTransferFromEvent: [TokenTransfer!] @derivedFrom(field: "from") tokenTransferToEvent: [TokenTransfer!] @derivedFrom(field: "to") tokenTransferOperatorEvent: [TokenTransfer!] @derivedFrom(field: "operator")}Zero-knowledge implementation
Safeguard data and transactions with cutting-edge zero-knowledge technologies that provide cryptographic assurances without compromising functionality.
- Languages: Circom.
- Libraries: Circom and Snark.js.
template ConnectFour() { // private input signal representing the board signal input board[6][7]; // winner of the game, either 1 or 2. signal input winner; // array of arrays with the indexes of the four consecutive counters signal input coordinates[4][2]; // intermediate signal for the number of winners signal numWinners; // intermediate signal for the winner after checking the board signal checkedWinner; // intermediate signal for the indexes of the four consecutive counters after // checking the board signal checkedWinningCoordinates[4][2]; // ...} component main = ConnectFour();Front-end development
Captivate an audience with user interfaces that ensure an intuitive and immersive experience for users, driving engagement and satisfaction.
- Languages: TypeScript.
- Frameworks: Next.js and Vite.
export function useAI(): { isSlow: boolean setIsSlow: Dispatch<SetStateAction<boolean>>} { const { status, turn, board, numCounters, mode } = useAppSelector(connectFourSelector) const dispatch = useAppDispatch() const timerId = useRef<null | NodeJS.Timeout>(null) // eslint-disable-line -- allow undef const [isSlow, setIsSlow] = useState<boolean>(true) useEffect(() => { const predict = async (): Promise<void> => { // ... } if (((mode === 'userVsAI' && turn === '2') || (mode === 'aIVsUser' && turn === '1')) && status !== 'gameOver') { timerId.current = setTimeout( () => { predict() // eslint-disable-line -- allow floating promise }, isSlow ? 1000 : 0, ) } return () => { if (timerId.current !== null) { clearTimeout(timerId.current) } } }, [mode, status, board, turn, dispatch, isSlow, numCounters]) return { isSlow, setIsSlow }}Back-end development
Power a platform with a robust and scalable back-end infrastructure ensuring flawless operation and reliability.
- Languages: TypeScript and Python.
- Frameworks: Express.js and Flask.
const logger: IWinstonLogger = new WinstonLogger(); const deleteByIdPath = join(deletePath, ':identifier');const getByIdPath = join(getPath, ':identifier'); const routesData: RouteData[] = [ // Valid requests method: createMethod, path: createPath, handler: createLoanController , method: deleteByIdentifierMethod, path: deleteByIdPath, handler: deleteLoanByIdentifierController , method: getAllMethod, path: getAllPath, handler: getAllLoansController , method: getByIdentifierMethod, path: getByIdPath, handler: getLoanByIdController , method: updateMethod, path: updatePath, handler: updateLoanController , // Invalid methods { method: 'all', path: createPath, handler: handleInvalidMethodController, isSync: true }, { method: 'all', path: deleteByIdPath, handler: handleInvalidMethodController, isSync: true }, { method: 'all', path: getAllPath, handler: handleInvalidMethodController, isSync: true }, { method: 'all', path: getByIdPath, handler: handleInvalidMethodController, isSync: true }, { method: 'all', path: updatePath, handler: handleInvalidMethodController, isSync: true }, // Unrecognized URLs { method: 'all', path: '*', handler: handleNotFoundController, isSync: true }]; async function main(): Promise<void> { new ExpressApi(logger, routesData).start(LoansConfigV1.PORT ?? '3003');} main().catch((error) => { logger.error(error); process.exit(0);});Machine learning modeling
Harness the power of AI to get insights and drive innovation with models tailored to specific needs in order to optimize business processes.
- Languages: Python.
- Libraries: PyTorch and Keras.
class ConnectFourNet(Module): def __init__(self, out_features: int): super(ConnectFourNet, self).__init__() self.policy = nn.Sequential( # (N, Cin, Hin, Win) -> (N, Cout, Hout, Wout) nn.Conv2d(2, 16, 3, 1, 1), nn.ReLU(), # (N, Cin, Hin, Win) -> (N, Cout, Hout, Wout) nn.Conv2d(16, 16, 3, 1, 1), nn.ReLU(), # (N, Cin, Hin, Win) -> (N, Hout) nn.Flatten(), # (N, Win) -> (N, Hout) nn.Linear(672, 128), nn.ReLU(), # (N, Win) -> (N, Hout) nn.Linear(128, out_features) ) # ... def forward(self, x: torch.Tensor, model: Literal['policy', 'target']): if model == 'policy': return self.policy(x) elif model == 'target': return self.target(x)Data science tasks
Extract actionable insights from data with advanced data science solutions to make informed decisions and drive growth.
- Languages: Python.
- Libraries: Pandas, Numpy, SciPy, Matplotlib, Seaborn...
def plot_bivariate(X, id_vars, value_vars, font_scale, col_wrap, height, aspect, function, labels_thresh=None, rotation=None): sns.set(font_scale=font_scale, style='darkgrid') plot_data = pd.melt(X, id_vars=id_vars, value_vars=value_vars, var_name="predictor", value_name="predictor_value") fgmap = sns.FacetGrid(plot_data, col="predictor", col_wrap=col_wrap, height=height, aspect=aspect, sharex=False, sharey=True).map(function, "predictor_value", id_vars) if rotation is not None: if labels_thresh is None: [plt.setp(ax.get_xticklabels(), rotation=rotation) for ax in fgmap.axes.flat] else: [plt.setp(ax.get_xticklabels(), rotation=rotation) for ax in fgmap.axes.flat if len(ax.get_xticklabels()) > labels_thresh]Projects

zk Connect Four
zk Connect Four is a zero-knowledge decentralised application that lets you play the game of Connect Four against a DQN agent-trained policy or against another user.

Bank Microservices
Bank Microservices is my own approach to a bank application, with a microservices-based architecture and using the MERN stack.

Olive Oil Trust
Olive Oil Trust is an olive oil traceability solution built on Ethereum that adapts the workflow of the olive oil long value chain to the blockchain through the use of smart contracts.

albertobas.com
This is my personal webpage, where I publish articles and side-projects.
Blog
zk-SNARK
How to build a zero-knowledge DApp
This post offers an introduction to how to develop an application capable of generating and...
Reinforcement learning
Training a DQN agent to play Connect Four
Exercise to obtain a policy that is capable of maximising this reward, thus obtaining the...
Microservices
Approach to a microservices-based architecture bank application
A microservices-based architecture bank application that includes back-end and front-end applications, as well as a...
Traceability
Introducing Olive Oil Trust: front end
Next.js application that gives support to members and customers in Olive Oil Trust, and reduces...
Traceability
Introducing Olive Oil Trust: subgraph
Subgraph to query data from Olive Oil Trust in an efficient way using TheGraph.
Traceability
Introducing Olive Oil Trust: smart contracts
Olive Oil Trust smart contracts are implemented in order to adopt a set of rules...
DeFi
How to build a DEXs analytics application
Introduction to obtaining and representing DEXs data using TheGraph and React.js