Rand Stats

Net::Ethereum

gitlab:pheix

Raku interface for Ethereum blockchain

A Raku interface for interacting with the Ethereum blockchain and ecosystem via JSON RPC API.

Synopsys

Quick start: compile and deploy new contract

#!/usr/bin/env raku

use Net::Ethereum;

my $ne = Net::Ethereum.new(
    :api_url('http://127.0.0.1:8501'),
    :show_progress(True),
    :unlockpwd('ospasswd'),
);

my %h = $ne.compile_and_deploy_contract(
    :contract_path('./sample.sol'),
    :compile_output_path('./compile'),
);
%h.gist.say;

Net::Ethereum class attributes

API documentation

This module was ported from Perl5 Net::Ethereum with core refactoring and breaking changes. Original Perl5 documentation could be incompatible with Raku Net::Ethereum, so feel free to report issues.

Known API differences

In Perl5 Net::Ethereum there are wait_for_contract and wait_for_transaction subroutines. Quick look for source code shows that this functions are very similar. In Raku Net::Ethereum we have one common method wait_for_transaction().

method wait_for_transaction( :@hashes!, Int :$iters?, Bool :$contract? ) returns Array { ... }

Method arguments are:

Running tests from test-bundle

Tests from test-bundle are rather adjustable and full function testing is available if:

If your node running on different port, use helper-script hooks/forward.sh for quick forwarding:

./forward.sh 8501 <your_actual_node_port>

Environment

You should set contract transaction hash at global env variable TXHASH:

export TXHASH=0x244409bb2cced62a2b93b2688167438ef47f60f1b5aa8b6c64e9de460ddec604

Run tests

Test could be ran with prove or prove6:

prove6 ./t
prove -ve 'raku -Ilib'

Author

Please contact me via LinkedIn or Twitter. Your feedback is welcome at narkhov.pro.

Perl5 Net::Ethereum

CPAN

METACPAN

Habrahabr

Author

Contrubutor