게시글
질문&답변
2024.01.22
needToCatchEvent 오류
네 디버깅하면서 logs가 안들어오는 것까지 확인을 했습니다. 그런데 어디 부터 잘못되는지 확인이 불가능합니다. 혹시 git에 소스코드 공유 부탁드려도 될까요? package event import ( "context" "event/config" "fmt" "math/big" "time" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" ethType "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" ) type Scan struct { config *config.Config FilterQuery ethereum.FilterQuery client *ethclient.Client } func NewScan(config *config.Config, client *ethclient.Client, catchEventList []common.Hash) (*Scan, chan []ethType.Log, error) { s := &Scan{ config: config, client: client, } eventLog := make(chan []ethType.Log, 100) scanCallection := common.HexToAddress("0x97D6Aba16E92d82A58519C452c006e4058A631D7") go s.lookingScan(config.Node.StartBlock, scanCallection, catchEventList, eventLog) return s, eventLog, nil } //44961870 // 배포 : 44961732 func (s *Scan) lookingScan(startBlock int64, scanCallection common.Address, catchEventList []common.Hash, eventLog chan uint64(startBlock) { fmt.Println("from Block", s.FilterQuery.ToBlock, "to Block", to) s.FilterQuery.ToBlock = big.NewInt(int64(to)) s.FilterQuery.FromBlock = big.NewInt(startReadtBlock) tryCount := 1 fmt.Println("s.FilterQuery : ", s.FilterQuery) Retry: if logs, err := s.client.FilterLogs(ctx, s.FilterQuery); err != nil { if tryCount == 3 { fmt.Println("failed to get Filter", "err", err.Error()) break } else { newTo := big.NewInt(int64(to) - 1) newFrom := big.NewInt(startBlock - 1) s.FilterQuery.ToBlock = newTo s.FilterQuery.FromBlock = newFrom tryCount++ goto Retry } } else if len(logs) > 0 { eventLog s.FilterQuery : { 44961732 52617540 [0x97D6Aba16E92d82A58519C452c006e4058A631D7] [[0xd99659a21de82e379975ce8df556f939a4ccb95e92144f38bb0dd35730ffcdd5]]} from Block 52617540 to Block 52617540 s.FilterQuery : { 44961732 52617540 [0x97D6Aba16E92d82A58519C452c006e4058A631D7] [[0xd99659a21de82e379975ce8df556f939a4ccb95e92144f38bb0dd35730ffcdd5]]} from Block 52617540 to Block 52617541 s.FilterQuery : { 44961732 52617541 [0x97D6Aba16E92d82A58519C452c006e4058A631D7] [[0xd99659a21de82e379975ce8df556f939a4ccb95e92144f38bb0dd35730ffcdd5]]} from Block 52617541 to Block 52617541 s.FilterQuery : { 44961732 52617541 [0x97D6Aba16E92d82A58519C452c006e4058A631D7] [[0xd99659a21de82e379975ce8df556f939a4ccb95e92144f38bb0dd35730ffcdd5]]} from Block 52617541 to Block 52617542 s.FilterQuery : { 44961732 52617542 [0x97D6Aba16E92d82A58519C452c006e4058A631D7] [[0xd99659a21de82e379975ce8df556f939a4ccb95e92144f38bb0dd35730ffcdd5]]} from Block 52617542 to Block 52617542 s.FilterQuery : { 44961732 52617542 [0x97D6Aba16E92d82A58519C452c006e4058A631D7] [[0xd99659a21de82e379975ce8df556f939a4ccb95e92144f38bb0dd35730ffcdd5]]} exit status 0xc000013a s.FilterQuery는 잘 들어오고 있는것 같은데 nil은 정상적인거죠?
- 0
- 3
- 166
질문&답변
2024.01.21
needToCatchEvent 오류
package event import ( "context" "event/config" "event/types" "fmt" "github.com/ethereum/go-ethereum/common" ethType "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" ) type Catch struct { config *config.Config client *ethclient.Client needToCatchEvent map[common.Hash]types.NeedToCatchEvent } func NewCatch(config *config.Config, client *ethclient.Client) (*Catch, error) { c := &Catch{ config: config, client: client, } c.needToCatchEvent = map[common.Hash]types.NeedToCatchEvent{ common.BytesToHash(crypto.Keccak256([]byte("Transfer(address,address,uint256"))): { NeedToCatchEventFunc: c.Transfer, }, } return c, nil } func (c *Catch) Transfer(e *ethType.Log, tx *ethType.Transaction) { fmt.Println("들어 왔습니다.") } // start To Catch Event func (c *Catch) StartToCatch(events package app import ( "event/config" "event/event" repostory "event/repository" ethType "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" ) type App struct { config *config.Config client *ethclient.Client repostory *repostory.Repostory scan *event.Scan catch *event.Catch } func NewApp(config *config.Config) { a := App{ config: config, } var err error if a.client, err = ethclient.Dial(config.Node.Uri); err != nil { panic(err) } else { if a.repostory, err = repostory.NewRepostory(config); err != nil { panic(err) } if a.catch, err = event.NewCatch(config, a.client); err != nil { panic(err) } var eventChan chan []ethType.Log if a.scan, eventChan, err = event.NewScan(config, a.client, a.catch.GetEventsToCatch()); err != nil { panic(err) } go a.catch.StartToCatch(eventChan) for { } } } 에러 코드는 없었습니다. 트랜잭션을 전송하셨는지 질문을 드렸는데? mumbai에 트랜잭션을 말씀하신건가요? => 테스트넷에서 0x9f878a0a73a53dd676d4f9ec58b823ab9130df335c8b38b4df8ac2d15f49adee 검색할 수 있는 트랜잭션 해쉬 코드 입니다. 실행 했을때의 로그입니다, Event가 들어 왔습니다. from Block to Block 52533290 from Block 52533290 to Block 52533290 from Block 52533290 to Block 52533291 exit status 0xc000013a
- 0
- 3
- 166
질문&답변
2023.11.18
create 요청시 에러
func (u *userRouter) create(c *gin.Context) { fmt.Println("create 입니다") var req types.CreateRequest if err := c.ShouldBindJSON(&req); err != nil { u.router.failedResponse(c, &types.CreateUserResponse{ ApiResponse: types.NewApiResponse(-1, "바인딩 오류", err), }) } else if err := u.userService.Create(req.ToUser()); err != nil { u.router.failedResponse(c, &types.CreateUserResponse{ ApiResponse: types.NewApiResponse(-1, "바인딩 오류", err), }) } else { u.router.okResponse(c, &types.CreateUserResponse{ ApiResponse: types.NewApiResponse(1, "성공 입니다.", err), }) } package types type ApiResponse struct { Result int64 json:"result" Description string json:"description" ErrCode interface{} json:"errCode" } func NewApiResponse(Result int64, Description string, errCode interface{}) *ApiResponse { return &ApiResponse{ Result: Result, Description: Description, ErrCode: errCode, } } package types type User struct { Name string json:"name" Age int64 json:"age" } type CreateUserResponse struct { *ApiResponse } type CreateRequest struct { Name string json:"name" binding:"require" Age int64 json:"age" binding:"require" } func (c CreateRequest) ToUser() User { return &User{ Name: c.Name, Age: c.Age, } } type GetUserResponse struct { *ApiResponse Users []*User json:result } type UpdateUserResponse struct { *ApiResponse } type UpdateRequest struct { Name string json:"name" binding:"require" UpdateAge int64 json:"updateAge" binding:"require" } type DeleteUserResponse struct { *ApiResponse } type DeleteRequest struct { Name string json:"name" binding:"require" } func (c DeleteRequest) ToUser() User { return &User{ Name: c.Name, } } 이렇게 되는데 if err := c.ShouldBindJSON(&req); err != nil { 여기서 문제가 발생했다고 합니다. 이유를 잘 모르겠습니다.
- 0
- 2
- 197
질문&답변
2022.11.19
nosuchfile
https://github.com/yundongjun/untitled 관련 파일 입니다.
- 0
- 1
- 162
질문&답변
2022.11.19
비대칭키 jwt 인증 문제
관련 내용에서 계속 안되서 질문 드립니다.
- 0
- 4
- 344
질문&답변
2022.11.19
비대칭키 jwt 인증 문제
env ApplicationReactiveWebEnvironment {activeProfiles=[], defaultProfiles=[default], propertySources=[MapPropertySource {name='server.ports'}, BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-file:///C:\\Users\\ydj90\\Downloads\\git/file:C:\Users\ydj90\Downloads\git\ecommerce.yml'}, ConfigurationPropertySourcesPropertySource {name='configurationProperties'}, MapPropertySource {name='springCloudBusOverridesProperties'}, MapPropertySource {name='gateway-properties'}, PropertiesPropertySource {name='systemProperties'}, OriginAwareSystemEnvironmentPropertySource {name='systemEnvironment'}, RandomValuePropertySource {name='random'}, CachedRandomPropertySource {name='cachedrandom'}, MapPropertySource {name='springCloudClientHostInfo'}, OriginTrackedMapPropertySource {name='Config resource 'class path resource [application.yml]' via location 'optional:classpath:/''}, MapPropertySource {name='spring.integration.poller'}, MapPropertySource {name='springCloudBusDefaultProperties'}, OriginTrackedMapPropertySource {name='Config resource 'class path resource [bootstrap.yml]' via location 'optional:classpath:/''}, MapPropertySource {name='springCloudDefaultProperties'}, {name='Management Server'}]} propertySources [MapPropertySource {name='server.ports'}, BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-file:///C:\\Users\\ydj90\\Downloads\\git/file:C:\Users\ydj90\Downloads\git\ecommerce.yml'}, ConfigurationPropertySourcesPropertySource {name='configurationProperties'}, MapPropertySource {name='springCloudBusOverridesProperties'}, MapPropertySource {name='gateway-properties'}, PropertiesPropertySource {name='systemProperties'}, OriginAwareSystemEnvironmentPropertySource {name='systemEnvironment'}, RandomValuePropertySource {name='random'}, CachedRandomPropertySource {name='cachedrandom'}, MapPropertySource {name='springCloudClientHostInfo'}, OriginTrackedMapPropertySource {name='Config resource 'class path resource [application.yml]' via location 'optional:classpath:/''}, MapPropertySource {name='spring.integration.poller'}, MapPropertySource {name='springCloudBusDefaultProperties'}, OriginTrackedMapPropertySource {name='Config resource 'class path resource [bootstrap.yml]' via location 'optional:classpath:/''}, MapPropertySource {name='springCloudDefaultProperties'}, {name='Management Server'}] user-service.yml spring: datasource: url: jdbc:h2:mem:testdb driver-class-name: org.h2.Driver generate-unique-name: false username: '{cipher}AQBZT1bZyyKdYnWBMbh5LSjRUV+5wt50pt9WClGg+hSu7ARkvke3ndRUX0zhI8GOCfn/bJUMS1wXKz/XjpPlILkarebYyMi7iE6czM0cNC3cj1ZsH2lyk2NVcfuWutAIUCxJutsPw4zx079JJ/Alg81ycnHewmBMWofVIfcn+RWkCwkANQkv/xljQUL2w9xLgFnpBAv2tL3fjwgfQBPFbJhg/711JYmZyP0vWIISlWhyj/IebG7DcJGA0HdTu2RMdiY7oy1sez7MyyOWue8AuwGF8ll6j4qNG/1bapmooF+c/O8SYSp4fV3IgBF1q9LHgsszl9dRfqlFiUYI/q0zHViG97gamN39Qm1/B8H9eyfz+KtWrgWQnLrlXCEsAxdg/8M=' token: expiration_time: 864000000 secret: '{cipher}AQCwCy3C26G+3di+9nxOgu2Dvb0jKOagWvPFRcsoeL5wGwId5zdxovCE/UOmMzxfm0oTmzLBr2j9I1gJvZtMtZ27lwgHlRjnZKai0bxrP9QEk5Uvwxb7mzzIYwnyRjCynIPNmxO399rZNMnb7WtTLz61lj9Nc8e4ijUgA4HfT1n+No6pIYBX2HdO3DLFPHQmCedusFCwJ4QsFVHfV/XRnnE6+AM6Sfjh6+8t1N2UxNZYPygUr2aueY1tTaHgZ1iz4uh6zT0X74fdwOCcDNIfBWwTcDpQChP3KEtfqK8XpWr6uf4r4/47ZShThPAS4ZvwCqtQmfnTL8kpH5AA2G8DgEPyVSZy8eU4oJWc83ebv/Nrbr+CMhe513/OcQpMli1D2Y4=' gateway: ip: 172.30.1.33 order_service: url: http://order-service/order-service/%s/orders exception: order_is_empty: User's orders is empty user-service => bootstrap.yml spring: cloud: config: uri: http://localhost:8888 name: user-service # profiles: # active: dev ecommerce.yml token: expiration_time: 864000000 secret: '{cipher}AQCwCy3C26G+3di+9nxOgu2Dvb0jKOagWvPFRcsoeL5wGwId5zdxovCE/UOmMzxfm0oTmzLBr2j9I1gJvZtMtZ27lwgHlRjnZKai0bxrP9QEk5Uvwxb7mzzIYwnyRjCynIPNmxO399rZNMnb7WtTLz61lj9Nc8e4ijUgA4HfT1n+No6pIYBX2HdO3DLFPHQmCedusFCwJ4QsFVHfV/XRnnE6+AM6Sfjh6+8t1N2UxNZYPygUr2aueY1tTaHgZ1iz4uh6zT0X74fdwOCcDNIfBWwTcDpQChP3KEtfqK8XpWr6uf4r4/47ZShThPAS4ZvwCqtQmfnTL8kpH5AA2G8DgEPyVSZy8eU4oJWc83ebv/Nrbr+CMhe513/OcQpMli1D2Y4=' gateway: ip: 172.30.1.33 apigateway-service => bootstrap.yml spring: cloud: config: uri: http://localhost:8888 name: ecommerce
- 0
- 4
- 344
질문&답변
2022.10.29
jwt 관련 질문입니다.
감사합니다.
- 0
- 2
- 1.2K
질문&답변
2022.10.26
spring mvc설정으로 인한 controller-mapping error
추가적으로 github url입니다. https://github.com/yundongjun/springsecurity
- 0
- 2
- 554