当前位置: 首页 > 工具软件 > Burrow > 使用案例 >

burrow, Execution Contexts

苏华藏
2023-12-01

SendTx

Tansfer tokens to destination.

github.com/hyperledger/burrow/execution/contexts.(*SendContext).Execute at send_context.go:22
github.com/hyperledger/burrow/execution.(*executor).Execute at execution.go:254
github.com/hyperledger/burrow/consensus/abci.ExecuteTx at execute_tx.go:30
github.com/hyperledger/burrow/consensus/abci.(*App).CheckTx at app.go:189
github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync at local_client.go:99
github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync at app_conn.go:114
github.com/tendermint/tendermint/mempool.(*CListMempool).CheckTx at clist_mempool.go:281
github.com/tendermint/tendermint/mempool.Mempool.CheckTx-fm at mempool.go:18
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxAsyncRaw at transactor.go:237
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSyncRaw at transactor.go:206
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSync at transactor.go:134
github.com/hyperledger/burrow/execution.(*Transactor).BroadcastTxSync at transactor.go:83
github.com/hyperledger/burrow/rpc/rpctransact.(*transactServer).BroadcastTxSync at transact_server.go:55
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler.func1 at rpctransact.pb.go:505
github.com/hyperledger/burrow/rpc.unaryInterceptor.func1 at grpc.go:29
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler at rpctransact.pb.go:507
google.golang.org/grpc.(*Server).processUnaryRPC at server.go:1024
google.golang.org/grpc.(*Server).handleStream at server.go:1313
google.golang.org/grpc.(*Server).serveStreams.func1.1 at server.go:722
runtime.goexit at asm_amd64.s:1357
 - Async stack trace
google.golang.org/grpc.(*Server).serveStreams.func1 at server.go:720

Job

jobs:


- name: sendTxTest1
  send:
      destination: 722ECB9236FFFD90304FC67D77652B476E19853D
      amount: 999


Sample

{
  "SendTx": {
    "Inputs": [
      {
        "Address": "D96DCA9368CADBF5F8813EEFD35C9E228E7F8B21",
        "Amount": 10000
      }
    ],
    "Outputs": [
      {
        "Address": "5F4852C172066A2AFAABF01FB2B86067B7148DC8",
        "Amount": 10000
      }
    ]
  }
}

NameTx

To store a name entry to StateDB

type Entry struct {
	// registered name for the entry
	Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
	// address that created the entry
	Owner github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,2,opt,name=Owner,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Owner"`
	// data to store under this name
	Data string `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
	// block at which this entry expires
	Expires              uint64   `protobuf:"varint,4,opt,name=Expires,proto3" json:"Expires,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}
github.com/hyperledger/burrow/execution/contexts.(*NameContext).Execute at name_context.go:32
github.com/hyperledger/burrow/execution.(*executor).Execute at execution.go:254
github.com/hyperledger/burrow/consensus/abci.ExecuteTx at execute_tx.go:30
github.com/hyperledger/burrow/consensus/abci.(*App).CheckTx at app.go:189
github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync at local_client.go:99
github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync at app_conn.go:114
github.com/tendermint/tendermint/mempool.(*CListMempool).CheckTx at clist_mempool.go:281
github.com/tendermint/tendermint/mempool.Mempool.CheckTx-fm at mempool.go:18
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxAsyncRaw at transactor.go:237
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSyncRaw at transactor.go:206
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSync at transactor.go:134
github.com/hyperledger/burrow/execution.(*Transactor).BroadcastTxSync at transactor.go:83
github.com/hyperledger/burrow/rpc/rpctransact.(*transactServer).BroadcastTxSync at transact_server.go:55
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler.func1 at rpctransact.pb.go:505
github.com/hyperledger/burrow/rpc.unaryInterceptor.func1 at grpc.go:29
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler at rpctransact.pb.go:507
google.golang.org/grpc.(*Server).processUnaryRPC at server.go:1024
google.golang.org/grpc.(*Server).handleStream at server.go:1313
google.golang.org/grpc.(*Server).serveStreams.func1.1 at server.go:722
runtime.goexit at asm_amd64.s:1357
 - Async stack trace
google.golang.org/grpc.(*Server).serveStreams.func1 at server.go:720

Job

jobs:

- name: val1
  set:
      val: "xjw"
      
- name: val2
  set:
      val: "testdata"      

- name: to_save
  set:
      val: 5000

- name: MinersFee
  set:
      val: 1

- name: nameRegTest1
  register:
      name: $val1
      data: $val2
      amount: $to_save
      fee: $MinersFee

- name: queryReg1
  query-name:
      name: $val1
      field: data

- name: nameRegAssert1
  assert:
      key: $queryReg1
      relation: eq
      val: $val2

Sample

{
	NameTx,
		Payload:{
			Input:{
				Address:D96DCA9368CADBF5F8813EEFD35C9E228E7F8B21,
				Amount:5000,
				Sequence:41
			},
			Name:			eris_loves,
			Data:			marmots,
			Fee:			1234
		}
}

PermsTx

Manage permissions of account.

github.com/hyperledger/burrow/execution/contexts.(*PermissionsContext).Execute at permissions_context.go:24
github.com/hyperledger/burrow/execution.(*executor).Execute at execution.go:254
github.com/hyperledger/burrow/consensus/abci.ExecuteTx at execute_tx.go:30
github.com/hyperledger/burrow/consensus/abci.(*App).CheckTx at app.go:189
github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync at local_client.go:99
github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync at app_conn.go:114
github.com/tendermint/tendermint/mempool.(*CListMempool).CheckTx at clist_mempool.go:281
github.com/tendermint/tendermint/mempool.Mempool.CheckTx-fm at mempool.go:18
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxAsyncRaw at transactor.go:237
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSyncRaw at transactor.go:206
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSync at transactor.go:134
github.com/hyperledger/burrow/execution.(*Transactor).BroadcastTxSync at transactor.go:83
github.com/hyperledger/burrow/rpc/rpctransact.(*transactServer).BroadcastTxSync at transact_server.go:55
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler.func1 at rpctransact.pb.go:505
github.com/hyperledger/burrow/rpc.unaryInterceptor.func1 at grpc.go:29
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler at rpctransact.pb.go:507
google.golang.org/grpc.(*Server).processUnaryRPC at server.go:1024
google.golang.org/grpc.(*Server).handleStream at server.go:1313
google.golang.org/grpc.(*Server).serveStreams.func1.1 at server.go:722
runtime.goexit at asm_amd64.s:1357
 - Async stack trace
google.golang.org/grpc.(*Server).serveStreams.func1 at server.go:720

Job

jobs:

- name: perm
  set:
      val: call

- name: role
  set:
      val: 1234

- name: permTest1
  permission:
      action: setBase
      target: $key2
      permission: $perm
      value: "true"

Sample

{
	PermsTx,
		Payload:
		{
			Input:
			{
				Address:D96DCA9368CADBF5F8813EEFD35C9E228E7F8B21,
				Sequence:51
			},
			PermArgs:
			{
				Action:setGlobal,
				Permission:call,
				Value:true
			}
		}
	}
}

CallTx

Call smart contacts.

github.com/hyperledger/burrow/execution/contexts.(*CallContext).Execute at call_context.go:36
github.com/hyperledger/burrow/execution.(*executor).Execute at execution.go:254
github.com/hyperledger/burrow/consensus/abci.ExecuteTx at execute_tx.go:30
github.com/hyperledger/burrow/consensus/abci.(*App).CheckTx at app.go:189
github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync at local_client.go:99
github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync at app_conn.go:114
github.com/tendermint/tendermint/mempool.(*CListMempool).CheckTx at clist_mempool.go:281
github.com/tendermint/tendermint/mempool.Mempool.CheckTx-fm at mempool.go:18
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxAsyncRaw at transactor.go:237
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSyncRaw at transactor.go:206
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSync at transactor.go:134
github.com/hyperledger/burrow/execution.(*Transactor).BroadcastTxSync at transactor.go:83
github.com/hyperledger/burrow/rpc/rpctransact.(*transactServer).BroadcastTxSync at transact_server.go:55
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler.func1 at rpctransact.pb.go:505
github.com/hyperledger/burrow/rpc.unaryInterceptor.func1 at grpc.go:29
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler at rpctransact.pb.go:507
google.golang.org/grpc.(*Server).processUnaryRPC at server.go:1024
google.golang.org/grpc.(*Server).handleStream at server.go:1313
google.golang.org/grpc.(*Server).serveStreams.func1.1 at server.go:722
runtime.goexit at asm_amd64.s:1357
 - Async stack trace
google.golang.org/grpc.(*Server).serveStreams.func1 at server.go:720

Job

jobs:

- name: deployStorageK
  deploy:
      contract: storage.sol

- name: setStorageBaseBool
  set:
      val: "true"

- name: setStorageBool
  call:
      destination: $deployStorageK
      function: setBool 
      data:
        - $setStorageBaseBool

Sample

{
CallTx
	{
		Input:
		{
			Address:D96DCA9368CADBF5F8813EEFD35C9E228E7F8B21,
			Amount:9999,
			Sequence:103
		},
		GasLimit:1111111111,
		Fee:9999,
		Data: ...,
		ContractMeta:
			[{
				CodeHash:7E997BB145BD3B91F2411E2967183D8431DCF5EEF6359C4FF87B0E21D8118D20,
				Meta:
				{
					ContractName:
					SimpleStorage,
					SourceFile:storage.sol,
					CompilerVersion:0.5.17+commit.d19bba13,
					Abi:
					[
						{constant:true,inputs:[],name:getAddress,outputs:[{internalType:address,name:retAddress,type:address}],payable:false,stateMutability:view,type:function},
						{constant:true,inputs:[],name:getBool,outputs:[{internalType:bool,name:retBool,type:bool}],payable:false,stateMutability:view,type:function},
						{constant:true,inputs:[],name:getBool2,outputs:[{internalType:bool,name:retBool,type:bool}],payable:false,stateMutability:view,type:function},
						{constant:true,inputs:[],name:getBytes,outputs:[{internalType:bytes32,name:retBytes,type:bytes32}],payable:false,stateMutability:view,type:function},
						{constant:true,inputs:[],name:getInt,outputs:[{internalType:int256,name:retInt,type:int256}],payable:false,stateMutability:view,type:function},
						{constant:true,inputs:[],name:getString,outputs:[{internalType:string,name:retString,type:string}],payable:false,stateMutability:view,type:function},
						{constant:true,inputs:[],name:getUint,outputs:[{internalType:uint256,name:retUint,type:uint256}],payable:false,stateMutability:view,type:function},
						{constant:false,inputs:[{internalType:address,name:x,type:address}],name:setAddress,outputs:[],payable:false,stateMutability:nonpayable,type:function},
						{constant:false,inputs:[{internalType:bool,name:x,type:bool}],name:setBool,outputs:[],payable:false,stateMutability:nonpayable,type:function},
						{constant:false,inputs:[{internalType:bool,name:x,type:bool}],name:setBool2,outputs:[],payable:false,stateMutability:nonpayable,type:function},
						{constant:false,inputs:[{internalType:bytes32,name:x,type:bytes32}],name:setBytes,outputs:[],payable:false,stateMutability:nonpayable,type:function},
						{constant:false,inputs:[{internalType:int256,name:x,type:int256}],name:setInt,outputs:[],payable:false,stateMutability:nonpayable,type:function},
						{constant:false,inputs:[{internalType:string,name:x,type:string}],name:setString,outputs:[],payable:false,stateMutability:nonpayable,type:function},
						{constant:false,inputs:[{internalType:uint256,name:x,type:uint256}],name:setUint,outputs:[],payable:false,stateMutability:nonpayable,type:function}
					]
				}
			}]
	}
}

GovTx

GovTx provides a set of TemplateAccounts and GovernanceContext tries to alter the chain state - validatorSet.

github.com/hyperledger/burrow/execution/contexts.(*GovernanceContext).Execute at governance_context.go:32
github.com/hyperledger/burrow/execution.(*executor).Execute at execution.go:254
github.com/hyperledger/burrow/consensus/abci.ExecuteTx at execute_tx.go:30
github.com/hyperledger/burrow/consensus/abci.(*App).CheckTx at app.go:189
github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync at local_client.go:99
github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync at app_conn.go:114
github.com/tendermint/tendermint/mempool.(*CListMempool).CheckTx at clist_mempool.go:281
github.com/tendermint/tendermint/mempool.Mempool.CheckTx-fm at mempool.go:18
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxAsyncRaw at transactor.go:237
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSyncRaw at transactor.go:206
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSync at transactor.go:134
github.com/hyperledger/burrow/execution.(*Transactor).BroadcastTxSync at transactor.go:83
github.com/hyperledger/burrow/rpc/rpctransact.(*transactServer).BroadcastTxSync at transact_server.go:55
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler.func1 at rpctransact.pb.go:505
github.com/hyperledger/burrow/rpc.unaryInterceptor.func1 at grpc.go:29
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler at rpctransact.pb.go:507
google.golang.org/grpc.(*Server).processUnaryRPC at server.go:1024
google.golang.org/grpc.(*Server).handleStream at server.go:1313
google.golang.org/grpc.(*Server).serveStreams.func1.1 at server.go:722
runtime.goexit at asm_amd64.s:1357
 - Async stack trace
google.golang.org/grpc.(*Server).serveStreams.func1 at server.go:720

Job

jobs:

- name: InitialTotalPower
  query-vals:
    field: "Set.TotalPower"

- name: AddValidator
  update-account:
    target: 5F0577625C94E3237C800DFAD3FB0949A1761C3013B40E53CC5F64F576BFB986
    native: 333
    power: 33333
    permissions: ["send"]

# Pull power from the validator set in the result of query-vals
- name: CheckAdded
  query-vals:
    field: "Set.${AddValidator.address}.Power"

- name: AssertPowerNonZero
  assert:
    key: $CheckAdded
    relation: gt
    val: 0

Sample

{
GovTx,
	Payload:
	{
		Inputs:
		[{
			Address:D96DCA9368CADBF5F8813EEFD35C9E228E7F8B21,
			Amount:333,Sequence:96
		}],
		AccountUpdates:
		[{
			PublicKey:
			{
				CurveType:ed25519,
				PublicKey:5F0577625C94E3237C800DFAD3FB0949A1761C3013B40E53CC5F64F576BFB986},
				Amounts:[{Type:Native,Amount:333},{Type:Power,Amount:33333}],
				Permissions:[send],
				Roles:[send]
		}]
	}
}

BondTx & UnbondTx

Identify

Identify Node info

github.com/hyperledger/burrow/execution/contexts.(*IdentifyContext).Execute at identify_context.go:24
github.com/hyperledger/burrow/execution.(*executor).Execute at execution.go:254
github.com/hyperledger/burrow/consensus/abci.ExecuteTx at execute_tx.go:30
github.com/hyperledger/burrow/consensus/abci.(*App).CheckTx at app.go:189
github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync at local_client.go:99
github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync at app_conn.go:114
github.com/tendermint/tendermint/mempool.(*CListMempool).CheckTx at clist_mempool.go:281
github.com/tendermint/tendermint/mempool.Mempool.CheckTx-fm at mempool.go:18
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxAsyncRaw at transactor.go:237
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSyncRaw at transactor.go:206
github.com/hyperledger/burrow/execution.(*Transactor).CheckTxSync at transactor.go:134
github.com/hyperledger/burrow/execution.(*Transactor).BroadcastTxSync at transactor.go:83
github.com/hyperledger/burrow/rpc/rpctransact.(*transactServer).BroadcastTxSync at transact_server.go:55
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler.func1 at rpctransact.pb.go:505
github.com/hyperledger/burrow/rpc.unaryInterceptor.func1 at grpc.go:29
github.com/hyperledger/burrow/rpc/rpctransact._Transact_BroadcastTxSync_Handler at rpctransact.pb.go:507
google.golang.org/grpc.(*Server).processUnaryRPC at server.go:1024
google.golang.org/grpc.(*Server).handleStream at server.go:1313
google.golang.org/grpc.(*Server).serveStreams.func1.1 at server.go:722
runtime.goexit at asm_amd64.s:1357
 - Async stack trace
google.golang.org/grpc.(*Server).serveStreams.func1 at server.go:720

Job

jobs:

- name: test1
  identify:
      nodekey: ".burrow/config/node_key.json"
      netaddress: "addrewss"

Sample

IdentifyTx,
	Payload:
	{
		Inputs:[{Address:D96DCA9368CADBF5F8813EEFD35C9E228E7F8B21,Sequence:105}],
		Node:
		{
			NetworkAddress:addrewss,
			TendermintNodeID:33F8A47B18EEE5F645BF9F3374AADE371976F8BD,
			ValidatorPublicKey:
			{	
				CurveType:ed25519,
				PublicKey:1EDF9DCA679EFA4A8D29F4099FD81A51D497878D8BBEDE1E161C00E08778CBBE
			}
		}
	}

Proposal

 类似资料:

相关阅读

相关文章

相关问答