Skip to content

Instantly share code, notes, and snippets.

chmod +x echo.py
docker run --rm -v $(pwd):/scratch:ro bandprotocol/runtime:1.0.1 /scratch/echo.py "Hello lambda"
#!/usr/bin/env python3
import sys
def main(data):
return data
if __name__ == "__main__":
try:
sudo systemctl enable yoda
sudo systemctl start yoda
[Unit]
Description=Yoda Daemon
After=network-online.target
[Service]
User=ubuntu
ExecStart=/home/ubuntu/go/bin/yoda r
Restart=always
RestartSec=3
LimitNOFILE=4096
rm -rf ~/.yoda # clear old config if exist
yoda config chain-id band-guanyu-testnet2
yoda config node http://localhost:26657
yoda config validator $(bandcli keys show YOUR_WALLET -a --bech val)
yoda config broadcast-timeout "5m"
yoda config rpc-poll-interval "1s"
yoda config max-try 5
bandcli config chain-id band-guanyu-testnet-private-0
bandcli config trust-node true
bandcli config node http://localhost:26657 # If you run bandd service on other server please point to it
curl --location --request POST '<your_api_endpoint>' \
--header 'Content-Type: application/json' \
--data-raw '{
"executable": "IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKaW1wb3J0IHN5cwoKZGVmIG1haW4oZGF0YSk6CiAgICByZXR1cm4gZGF0YQoKCmlmIF9fbmFtZV9fID09ICJfX21haW5fXyI6CiAgICB0cnk6CiAgICAgICAgcHJpbnQobWFpbigqc3lzLmFyZ3ZbMTpdKSkKICAgIGV4Y2VwdCBFeGNlcHRpb24gYXMgZToKICAgICAgICBwcmludChzdHIoZSksIGZpbGU9c3lzLnN0ZGVycikKICAgICAgICBzeXMuZXhpdCgxKQo=",
"calldata": "\"Hello lambda\"",
"timeout": 3000
}'
{
"returncode": 0,
"stdout": "Hello lambda\n",
"stderr": ""
}
@taobun
taobun / example.json
Last active July 9, 2020 14:03
Simple lambda
{
"executable": "IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKaW1wb3J0IHN5cwoKZGVmIG1haW4oZGF0YSk6CiAgICByZXR1cm4gZGF0YQoKCmlmIF9fbmFtZV9fID09ICJfX21haW5fXyI6CiAgICB0cnk6CiAgICAgICAgcHJpbnQobWFpbigqc3lzLmFyZ3ZbMTpdKSkKICAgIGV4Y2VwdCBFeGNlcHRpb24gYXMgZToKICAgICAgICBwcmludChzdHIoZSksIGZpbGU9c3lzLnN0ZGVycikKICAgICAgICBzeXMuZXhpdCgxKQo=",
"calldata": "\"Hello lambda\"",
"timeout": 3000
}
@taobun
taobun / getter.sol
Created October 9, 2019 08:05
Simple getter/setter contract
pragma solidity >=0.4.22 <0.6.0;
contract GetterSetter {
uint value;
constructor(uint _initValue) public {
value = _initValue;
}
function getValue() public view returns (uint) {